In the list view, how to build a link to edit the item

Archived from the Xataface Users forum.

Jean — Tue Jan 27, 2009 9:02 am

Hi Steve,

I used renderCell() to modify the link. But I can’t get the cursor value.

Code: Select all
`function libelle__renderCell(&$record){

echo ‘<pre>‘;print_r($record);echo ‘</pre>‘;exit;
$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
$table =$query[‘-table’];
$cursor=$record->val(‘id_moyen’);
$skip=$query[‘-skip’];
$cursor=$_REQUEST[‘-cursor’];
$limit=$query[‘-limit’];
$mode=$query[‘-mode’];

return ‘’.$record->val(‘libelle’).’’;
}`

How can I get it ?

Thank you

Jean


shannah — Tue Jan 27, 2009 11:45 am

Hi Jean,

The cursor can be retrieved from the query. It marks the position in the result set that the ‘details’ tab is currently showing:

Code: Select all
$query =& $app->getQuery(); echo $query['-cursor'];

Jean — Wed Jan 28, 2009 12:48 am

Thank you Steve. No it does not work.

I tried

Code: Select all
$cursor=$query['-cursor'];

in my function but I have a cursor at 0.

Jean


Jean — Wed Jan 28, 2009 3:25 am

The problem is that all cursor values in the $record are on 0.

Jean


shannah — Wed Jan 28, 2009 9:27 am

I see. The -cursor value refers to the single position in the result set of the current record. This does not change for each row. It points to one particular record in the found set. The default is 0.

Unfortunately there is no way to get the row number from the renderCell() method at this time. I suppose that could be useful. I’ll add it to a todo list for a future version.

What were you trying to accomplish with the cursor? Perhaps there is another way to do what you want to do.

-Steve


Jean — Wed Jan 28, 2009 10:29 am

Thank you again, Steve. Actually, I want to replace the “browse” link in the list view by a “edit” link.

Jean


shannah — Wed Jan 28, 2009 11:36 am

You can use the default_browse_action directive in the conf.ini file.

e.g. at the beginning of your conf.ini file, add

Code: Select all
default_browse_action=edit

Jean — Wed Jan 28, 2009 12:40 pm

Well, much simpler

Jean