danabase Posted November 23, 2009 Posted November 23, 2009 I am relatively new to PHP and run into a couple problems I cannot figure out: 1.) The First, Previous, Next and Last buttons lose the sort of the first page. If a User performs a find, the list comes up sorted by name, but when they click the NEXT button for the next group, those records are unsorted. I can see the definition of the function that controls those links in fmview.php, but I don't know how to modify it. Here is the code: function getStatusLinks($resultPage, $rs, $skip, $max) { $links = array ( 'first' => 'First', 'prev' => 'Prev', 'records' => array ( 'rangestart' => 0, 'rangeend' => 0, 'foundcount' => 0 ), 'next' => 'Next', 'last' => 'Last' ); $fetchcount = $rs->getFetchCount(); $foundcount = $rs->getFoundSetCount(); $total = $rs->getTableRecordCount(); if ($total == 0 || $fetchcount == 0) { return $links; } else { if ($fetchcount > 0) { if ($skip > 0) { $links['first'] = "" . $links['first'] . ""; if ($skip > $max) { $prevskip = $skip - $max; $links['prev'] = "" . $links['prev'] . ""; } } if ($foundcount - $skip > $max) { $nextskip = $skip + $max; $links['next'] = "" . $links['next'] . ""; $lastskip = $foundcount - $max; $links['last'] = "" . $links['last'] . ""; } $links['records']['rangestart'] = max($skip, 1); $links['records']['rangeend'] = min($foundcount + $skip, $fetchcount + $skip); $links['records']['foundcount'] = $foundcount; } } return $links; } I did try to add a sortorder and sortfield to the links in fmview.php, but it worked for the found set, and then the subsequent finds no longer worked. 2.) Along similar lines, I would like next, previous, last, and first links to move from record to record in the browse record view. Any help would be appreciated. Thanks!
jonathanstark Posted November 28, 2009 Posted November 28, 2009 Paging through result records is actually complex enough that the specifics of your situation can dictate the best approach.
Recommended Posts
This topic is 5731 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now