List View Links

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

Postby meikel » Sun Jul 01, 2007 3:00 am

Hi there,
I successfully changed the column order in "List" view according to http://framework.weblite.ca/documentation/how-to/list_tab, but lost then all the links permitting to change ascending/descending order of columns, and permitting to click on one record, in order to proceed to "Edit" view. What code has to be added to the custom Header & Row definitions, in order to get these links back?

Secondly: where can I get an in depth explanation on how to setup roles?

TIA for helping me
kind regards
meikel
meikel
 
Posts: 17
Joined: Wed Dec 31, 1969 5:00 pm

Postby 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();
}
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 34 guests

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