adding existing record (relation): lookup widget not select

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

adding existing record (relation): lookup widget not select

Postby omills » Mon Sep 20, 2010 2:18 pm

Hi,

Is there a way to replace the select drop down list widget in the "add existing ... record" tab with something like the lookup widget in field settings. The select box gets very crowded when the related table has thousands of records!

Thanks!

Olivier
omills
 
Posts: 18
Joined: Sat Nov 07, 2009 11:01 am

Re: adding existing record (relation): lookup widget not select

Postby omills » Mon Sep 20, 2010 2:28 pm

Here is some insight I found in a previous post: http://xataface.com/forum/viewtopic.php?f=4&t=5033&p=24553
omills
 
Posts: 18
Joined: Sat Nov 07, 2009 11:01 am

Re: adding existing record (relation): lookup widget not select

Postby shannah » Mon Sep 20, 2010 2:30 pm

I know... the current interfaces for adding related records is starting to feel very dated. We definitely have all of the tools to put together something more elegant, just haven't had the time.

This has been on my list for a while, but haven't had any projects yet where it has become a pain point.

Do you find that it takes a long time to load the select list when it is large, or is it more of an inconvenience when using the select list to browse thousands of records. If it is the latter, a pure javascript solution could easily be constructed to convert the select list into a more flexible widget.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: adding existing record (relation): lookup widget not select

Postby omills » Mon Sep 20, 2010 2:46 pm

Hi,
thanks for your support and prompt reply... unfortunately my JS skills are limited, and my insight into the dataface api is limited.. but its something I would definitely look into if there is no easy alternative. I will look into the lookup widget to see how it can be used instead. It might end-up being a dirty hack (which I would like to avoid) but if you can provide some starters that would be great. Thanks again.
Olivier
omills
 
Posts: 18
Joined: Sat Nov 07, 2009 11:01 am

Re: adding existing record (relation): lookup widget not select

Postby omills » Thu Oct 07, 2010 5:15 pm

If we stick with the current "select" widget, could you clarify, how it pulls the content for the select box? How do I customize the label of the option title of the select box items? They dont seem to take into account, the getTitle() of the table, ie:

Code: Select all
people table
ID
salutation
name
...

organisation table
ID
orgname
...

organisationpeople table
peopleID
orgID


in a many to many relationship, in the organisation relationship file I have
Code: Select all
[people]
people.ID = organisationspeople.peopleID
organisationspeople.organisationsID = "$ID"

in the people.php file in the people table folder I have:
Code: Select all
   function getTitle(&$record){
      if($record->val('email'))
         $showemail  = " (" . $record->val('email') . ")";
      return $record->val('firstname'). " " . $record->val('surname') . $showemail  ;
   }


But it still fills the select box with the first text entry it finds in the people table which is salutation, not getTitle output as I would like it.
omills
 
Posts: 18
Joined: Sat Nov 07, 2009 11:01 am

Re: adding existing record (relation): lookup widget not select

Postby shannah » Thu Oct 07, 2010 5:32 pm

The add existing record drop down list uses the titleColumn() method for labels rather than the getTitle() method. The titleColumn returns a n SQL expression rather than using values already in memory. This is more appropriate for situations where we need the title of large quantities of records at once.

There is an example of the titleColumn() method in the getting started tutorial in the section about delegate classes.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 15 guests

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