Page 1 of 1

PostPosted: Sun Jul 01, 2007 3:00 am
by meikel
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

PostPosted: Tue Jul 03, 2007 3:10 pm
by shannah
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();
}