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

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

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

Postby 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 '<a>'.$record->val('libelle').'</a>';

How can I get it ?
Thank you
Jean
Jean
 
Posts: 259
Joined: Wed Nov 07, 2007 1:30 am
Location: Pau, France

Postby 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'];
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby 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
 
Posts: 259
Joined: Wed Nov 07, 2007 1:30 am
Location: Pau, France

Postby Jean » Wed Jan 28, 2009 3:25 am

The problem is that all cursor values in the $record are on 0.
Jean
Jean
 
Posts: 259
Joined: Wed Nov 07, 2007 1:30 am
Location: Pau, France

Postby 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
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby 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
Jean
 
Posts: 259
Joined: Wed Nov 07, 2007 1:30 am
Location: Pau, France

Postby 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
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby Jean » Wed Jan 28, 2009 12:40 pm

Well, much simpler :wink:
Jean
Jean
 
Posts: 259
Joined: Wed Nov 07, 2007 1:30 am
Location: Pau, France


Return to Xataface Users

Who is online

Users browsing this forum: Google [Bot] and 14 guests

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