February 7, 200817 yr 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...
April 11, 200817 yr 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);
Create an account or sign in to comment