Page 1 of 1

PostPosted: Wed Jul 18, 2007 2:41 pm
by vlad
Hi,
Currently my list view looks something like this:

Credit Union City State ZIP CEO
Name 1 Portsmouth NH 12345 John Q Test
Name 2 Los Angeles CA 54321 Mike Test

When a user clicks the city name . He will be redirected to view that record in detail. I would like him to be redirected to view a list of all companies in that city. Or when he clicks the zip to view all companies in that zip code.

Excuse me for asking so many questions.
Thank you.

PostPosted: Wed Jul 18, 2007 3:26 pm
by shannah
You can implement the %fieldname%__renderCell() method for the fields you want to change.

e.g.

function city__renderCell(&$record){
return ''.$record->strval('city').'';
}

You can find more info about this at http://framework.weblite.ca/documentation/how-to/list_tab

-Steve

PostPosted: Fri May 29, 2009 2:42 pm
by mikep
The documentation says this method can be implemented using the delegate classes. How do I access those?

Thanks,
Mike

PostPosted: Tue Jun 02, 2009 1:27 am
by silma
The delegate classes are the php file you create for each table.

For exemple, if you have a table called "Courses" , your delegate classes for this table would be "courses.php" and you'll find it (or create it) in my_app/tables/courses/

Here's the documentation : http://xataface.com/documentation/tutorial/getting_started/delegate_classes

(Sorry for the english)

PostPosted: Fri Jun 05, 2009 2:16 pm
by mikep
Ok. I got my delegate classes working. Here's my delema. I have a table called Jobs which has a column called Customer_ID which references Customer.Customer_ID. When I click Customer_ID in the list view for my Jobs table, I would like it to automatically redirect me to that customer's record in the Customer table.

I can't figure out how to construct the link so that xataface knows which Customer to direct me to. When I click a Customer_ID in my Customer table, it sends me to the url

http://localhost/index.php?-table=Custo ... -mode=list

It appears as though the 'cursor' variable controls which record I get sent to. Is there a different variable I can specify?

PostPosted: Fri Jun 05, 2009 7:38 pm
by shannah
You can accomplish this with the Customer_ID__renderCell() method of the delegate class for your Jobs table.

E.g.

Code: Select all
function Customer_ID__renderCell(&$record){
    return '<a href="'.DATAFACE_SITE_HREF.'?-table=Customer&Customer_ID='.$record->val('Customer_ID').'">'.$record->val('Customer_ID').'</a>';
}


And then add the noLinkFromListView=1 flag to the fields.ini file for the Customer_ID field of the Job table so that Xataface doesn't also try to make that cell link to the Job record as usual.

e.g.

Code: Select all
[Customer_ID]
    noLinkFromListView=1


-Steve

PostPosted: Fri Jun 05, 2009 7:39 pm
by shannah
See http://xataface.com/wiki/URL_Conventions for information about Xataface URL conventions so that you can easily construct URLs to any part of your application.

PostPosted: Sat Jun 06, 2009 6:39 am
by mikep
That did it. Thanks a lot for being so accessible.