Trying to set default sort order in list

A place for users and developers of the Xataface to discuss and receive support.

Trying to set default sort order in list

Postby 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>";
?>
Jusmee
 
Posts: 22
Joined: Mon Feb 01, 2010 5:11 pm

Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 45 guests

Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved