Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Splitting a query with modulo

Participant ,
Oct 30, 2008 Oct 30, 2008
Hello

I'm stuck in a problem which I started in an other post. Unfortunately I didn't really get the answers which satisfy me. Even though there were good inputs.

Assume we have a query with 9 results and I would like to build DIVs containing 2 results each. Every DIV is set to 'display: none;', so nothing is displayed on a page for the moment!

Somewhere below these DIVs I place back and forward arrows in DIVs to navigate through the DIVs above without reloading the page (!). I managed to build the sets of DIVs an giving them an ID (see code). Every ID appears twice, once in the DIV containg the 2 results and once in the DIV containing the navigation arrows. This because I want to display the arrows (always a set of 2) depending on where I am staying in navigation. Means, when I display the first DIV there is no option to go backwards, so the back arrow is inactive. If you go one step forward you can navigate backwards and forwards so both arrows have to be active. At the very end you cannot navigate forward any longer so I would like to display a forward button which I inactive (and a backwards button which is active).

The whole displaying should be controled by JavaScript.

It seems that I have several problems. First the Javascript isn't working properly - I couldn't figure out why? And the Mozilla shows all DIVs. And then the whole navigation through the sets doesn't work the way it should. I prepared the entire code (see below). You can add it to an empty cfm file and it should work - at least whats working for the moment ;-)

I'm really thankful for a solution.

425
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Nov 17, 2008 Nov 17, 2008
If anybody is interested.... Meanwhile I found theanswer to my problem. You need 6 images:
2 for inactive state
2 for active state
and 2 for hover state
Translate
Participant ,
Oct 30, 2008 Oct 30, 2008
Hi,

You should have a look at the the attributes startrow="" and maxrows="" of the output tag.
Based on the Rowcount attribute of the query you can output the first half or the second half of the query result with it (or divide it into more areas if necessary).

From a design perspective is your goal not ideal for most applications.
The reason why people usually implement a 1ToN interface like you are planning is because you have a huge result set (as example 1000s of users). In this case you would with your approach always render the HTML for 1000 altough the webuser would only look at a small portion of it. In this case it would be far better to only render the HTML for the accounts the user wants to see right now (again using startrow / maxrows), and really create a new page for the next / previous set of accounts. This way you only have to render a small HTML page, that gets returned to the user faster, and makes him happier.

(If you really only have a small number of records your approach would work though, but since you are still learning I though to mention it ;-)

Cheers,
fober
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 31, 2008 Oct 31, 2008
Thank you fober1 for your considerations.

I was thinking about startrow/maxrow and then decided that the user experience is better if the page does not reload because the results of the queries NEVER exceed 50. That's the reason I insist on my approach...
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 17, 2008 Nov 17, 2008
LATEST
If anybody is interested.... Meanwhile I found theanswer to my problem. You need 6 images:
2 for inactive state
2 for active state
and 2 for hover state
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources