Untitled Record...?

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

Untitled Record...?

Postby kokoro » Tue Mar 03, 2009 5:33 pm

Hello,

I am working on relationships and have set up a "one to one" relationship....I guess that is what I should call it as follows in a relationships.ini file located in the mdl_user directory:

[User Info Data]
mdl_user_info_data.userid = mdl_user.id

User Info Data is what I wanted as the title of the tab that appears. That was accomplished but for some reason I don't get the capitalization. The relationship also seems to work because when I go to my mdl_user tab from my Xataface application and click on a user I can see the link to the user info data. There is a tab titled user info data at the top of that record and on the left of the main page I get a box that says "this record" and has an ajax looking interface to 'drill down' to the related record.

So, my question is this, the records that are linked come up as "untitled". They do have data in them but I cannot figure out how to give them a title?

I was thinking that I need to accomplish this by "Customizing field labels, descriptions, and widgets" but that tutorial doesn't seem to get me where I'm trying to go.

Any pointers will be most appreciated.

Jason

I guess what I want to do is change the setting for which field Xataface uses as the record title. I notice with other records that do get titled that Xataface appears to be using the field that is next to the 'key' or 'id' field in each table. In some of my (actually many) of my tables I would rather use a different field or even be able to have the record name be inherited from the relationship (source table).
kokoro
 
Posts: 39
Joined: Fri Feb 06, 2009 6:17 am

Postby kokoro » Wed Mar 04, 2009 11:28 pm

Replying to myself here...

I have been poking around trying to figure out where Xataface gets the title for records but can't seem to figure it out or how to change the setting.

I'm getting

Current Record: Untitled "my table name" Record

and would like to have the "untitled (my table name) record" changed to a specific field from that record but can't seem to figure out how to get that done....?

Any help will be appreciated.

Jason
kokoro
 
Posts: 39
Joined: Fri Feb 06, 2009 6:17 am

Postby shannah » Thu Mar 05, 2009 9:25 am

Define the getTitle() method in the delegate class to provide your own title. Xataface tries to guess the title if you don't explicitly define it. It generally takes the first varchar field that it finds.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby kokoro » Thu Mar 05, 2009 2:58 pm

Steve,

Thanks. I know I'm asking really simple questions and I really appreciate your patience and help.

I was able to use the getTitle() method in a delegate class file successfully but that now brings me to another question.

The title of the record is successfully changed to the value I assigned it in the delegate class but the drop down menu that appears just above the title is still using the first varchar value. How do I change it so that will use the same field that I have assigned for the title?

Jason
kokoro
 
Posts: 39
Joined: Fri Feb 06, 2009 6:17 am

Postby shannah » Thu Mar 05, 2009 3:04 pm

For performance reasons the jump menu doesn't use the getTitle() method. THis is because the getTitle() method may require that the entire record be loaded - and it's terribly inefficient to have to load the whole table just to generate a little jump menu.

For the jump menu use the titleColumn() method in the delegate class. This method should simply return the SQL column name that should be used for the title.

e.g.
Code: Select all
function titleColumn(){
    return 'first_name';
}


if you wanted the 'first_name' column to be used for the title. Or if you want a concatenation of multiple fields, you could use the MySQL Concat function:

Code: Select all
function titleColumn(){
    return 'CONCAT(first_name," ",last_name)';
}


-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby kokoro » Fri Mar 06, 2009 1:39 am

Steve,

Beautiful!! Thanks a million. I used concat and now have the full names in the jump menu....great! I'm still working on setting up a production app and am not sure if having all the names in the jump menu is really going to be helpful or necessary since I will have close to 2000 of them. Maybe in that case the jump menu won't even been needed. I'll keep experimenting and probably asking for help....hopefully not with stuff that is too remedial.

Thanks once again for your patient and very helpful support.

Jason
kokoro
 
Posts: 39
Joined: Fri Feb 06, 2009 6:17 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 16 guests

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