Page 1 of 1

adding existing record (relation): lookup widget not select

PostPosted: Mon Sep 20, 2010 2:18 pm
by omills
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

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

PostPosted: Mon Sep 20, 2010 2:28 pm
by omills
Here is some insight I found in a previous post: http://xataface.com/forum/viewtopic.php?f=4&t=5033&p=24553

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

PostPosted: Mon Sep 20, 2010 2:30 pm
by shannah
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.

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

PostPosted: Mon Sep 20, 2010 2:46 pm
by omills
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

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

PostPosted: Thu Oct 07, 2010 5:15 pm
by omills
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.

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

PostPosted: Thu Oct 07, 2010 5:32 pm
by shannah
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.