Trying to set default sort order in list
Archived from the Xataface Users forum.
Jusmee — Sat Jun 26, 2010 4:00 pm
I am trying to follow the suggestion in the wiki here http://xataface.com/documentation/how-to/list_tab. I want my application to start with a particular column sorted in descending order. I have added a line to my index.php as follows. It is a vinyl record collection database and the ‘latestmusic’ table has a ‘Shelf’ field with the catalog number in it that I want to be sorted in descending order. The code seems to have to effect.
- Code: Select all
- `<?php
if ( !isset($_REQUEST[‘-sort’]) and @$_REQUEST[‘-table’] == ‘latestmusic’ ){
$_REQUEST[‘-sort’] = $_GET[‘-sort’] = ‘Shelf desc’;
}
/**- File: index.php
- Description:
- This is an entry file for this Dataface Application. To use your application
- simply point your web browser to this file.
*/
$time = microtime(true);
// use the timer to time how long it takes to generate a page
require_once ‘/var/www/xataface/dataface-public-api.php’;
// include the initialization file
df_init(FILE, ‘/xataface’);
// initialize the site
$app =& Dataface_Application::getInstance();
// get an application instance and perform initialization
$app->display();
// display the application
$time = microtime(true) - $time;
echo “<p>Execution Time: $time</p>”;
?>`