List view.

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

Postby vlad » Wed Jul 18, 2007 2:41 pm

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.
vlad
 
Posts: 28
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Wed Jul 18, 2007 3:26 pm

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

Postby mikep » Fri May 29, 2009 2:42 pm

The documentation says this method can be implemented using the delegate classes. How do I access those?

Thanks,
Mike
mikep
 
Posts: 44
Joined: Fri Apr 24, 2009 2:21 pm

Postby silma » Tue Jun 02, 2009 1:27 am

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)
silma
 
Posts: 87
Joined: Tue Apr 28, 2009 11:47 pm

Postby mikep » Fri Jun 05, 2009 2:16 pm

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?
mikep
 
Posts: 44
Joined: Fri Apr 24, 2009 2:21 pm

Postby shannah » Fri Jun 05, 2009 7:38 pm

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

Postby shannah » Fri Jun 05, 2009 7:39 pm

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

Postby mikep » Sat Jun 06, 2009 6:39 am

That did it. Thanks a lot for being so accessible.
mikep
 
Posts: 44
Joined: Fri Apr 24, 2009 2:21 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 34 guests

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