fchieli2 Posted February 7, 2008 Posted February 7, 2008 Hi, I have a small site (contacts) generated with php site assistant. Let's say in the record list page I have the first 25 records of a found set. I have the option to sort them let's say by Last name by clicking on the underlined column header. Everything works as expected, but when I click on Next (25 records) the sort order is lost and contacts are again presented in an order that is not by Last name...
andygaunt Posted April 11, 2008 Posted April 11, 2008 Interestingly I just had a call from someone at FileMaker regarding this issue that they were struggling to solve. The issue is that the function getStatusLinks does not include any sort order. Listed below is a fix for this issue that now adds the sort order if present in the current url and passes that correctly to the pagination function. In the fmview.php file replace the function getStatusLinks in its entirety with that listed below function getStatusLinks($resultPage, $rs, $skip, $max, $sort) { $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; } Now, replace your $statusLinks variable on your recordlist.php page with the following two lines. if (isset($_GET['-sortfieldone'])) $sort = "&-sortfieldone=".$_GET['-sortfieldone']."&-sortorderone=".$_GET['-sortorderone']; $statusLinks = getStatusLinks("recordlist.php", $result, $skip, $max, $sort);
Recommended Posts
This topic is 6338 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