Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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...

  • 2 months later...

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

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.