Software Design
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreSoftware Design

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 27th, 2002, 02:02 AM
getchoo getchoo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Posts: 20 getchoo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
displaying 10 rows in each page and creates a new form if it exceeds that page

I'm trying to create a form that does the following in jsp/javascript

Displays 10 rows, each row containing a record
if records exceeds 10, it will display the remaining records on another page.The first form will contain a link to the second form and the second form will contain the link to the first. So basically there could be infinite number of forms containing 10 rows each on each form each displaying a link to the other forms.

Help
Comments on this post
BaronVonDoppleG agrees!

Reply With Quote
  #2  
Old February 27th, 2002, 07:55 AM
Hermetiker Hermetiker is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Location: Vienna, Austria
Posts: 13 Hermetiker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
not jsp/javascript, but maybe it helps ...
Code:
$index = $q->params('i'); #first page is called with i=1
$max = ???; #number of rows
$MAXROWS = 10;

$end = $max;
$next = 0;
if (($max - $index) >= $MAXROWS) {
  $end = $index + $MAXROWS - 1;
  $next = 1;
}

#rows
for ($i = $index; $i <= $end; $i++) {
  print $rows[$i - 1]; #if first elements index is 0
}

#prev-link
if ($index > 1) {
  $j = $index - $MAXROWS;
  if ($j < 1) {
    $j = 1;
  }
  print "<a href='http://url?i=$j'>Prev</a>";
}

#direct links
if ($max > $MAXROWS) {
  for ($i = 1; $i <= $max; $i = $i + $MAXROWS) {
    if (($i >= $index) && ($i < ($index + $MAXROWS))) {
      print " $i "; #actual page is not a link
    } else {
      print " <a href='http://url?i=$i'>$i</a> ";
    }
  }
}

#next link
if ($next) {
  print "<a href='http://url?i=" . ($end + 1) . "'>Next</a>";
}


sorry, but i had no time to test the code. maybe you have to add somewhere a +/- 1 or so

Last edited by Hermetiker : February 27th, 2002 at 07:57 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > displaying 10 rows in each page and creates a new form if it exceeds that page


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT