by shannah » Tue Jul 03, 2007 3:10 pm
Hi Meikel,
Unfortunately this is one of the nice things that gets lost when you customize. However, it isn't tremendously difficult to duplicate the functionality yourself. Dataface works with consistent url schemes. The '-sort' get parameter is used to sort results.
e.g. url: /path.to/index.php?-table=foo&-sort=name
Would give you the foo table sorted on the name column in ascending order.
-sort=name+desc
sorts on name in descending order
-sort=name+desc,age
Sorts on name in descending order, then on age in ascending order.
There is also a SortControl class that you can use, and a {sort_controller} smarty tag that you can use that will output a control that will allow you to sort the results.
Example use of the SortControl class:
import('Dataface/SortControl.php');
$sc = new Dataface_SortControl('foo');
echo $sc->toHtml();
// This will display a sort control to sort records on the 'foo' table.
If you wanted to make this show up before your result list, you might add a before_result_list block in your delegate class as follows:
function block__before_result_list(){
$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
import('Dataface/SortControl.php');
$sc = new Dataface_SortControl($query['-table']);
echo $sc->toHtml();
}