Search/Filter on add existing record

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

Search/Filter on add existing record

Postby wisni1rr » Tue Feb 28, 2012 12:19 pm

Is it possible to make the "add exiting record" in a many to many relationship be either searchable or filterable. I need to narrow the options in the pulldown. It is possible to have thousands of existing records to add to the relationship and it is a little tedious to navigate through them all.

Thanks again!
wisni1rr
 
Posts: 107
Joined: Mon Feb 13, 2012 9:03 pm

Re: Search/Filter on add existing record

Postby shannah » Tue Feb 28, 2012 12:23 pm

Unfortunately I don't have any good solutions for this right now. This is one of the things that is getting a rebuild in Xataface 2.0 - but that won't be ready for a few months.

You can define custom options for this dropdown using the vocabulary:existing directive in the relationships.ini file or the relationshipname__getAddableValues() method in the delegate class.

But these aren't full solutions to get a searchable list.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Search/Filter on add existing record

Postby wisni1rr » Tue Feb 28, 2012 2:23 pm

Thank you, Steve.

Can't wait till 2.0 is finished. I am very thankful you have created such a fine tool. Bravo!
wisni1rr
 
Posts: 107
Joined: Mon Feb 13, 2012 9:03 pm

Re: Search/Filter on add existing record

Postby rtresidd » Mon Sep 03, 2012 2:18 am

Hi Steve just checking how this update is coming along.
I've got a dropdown list that is filled with a concatenated string that merges a couple of tables..

Basic table layout...
BoardItems:
id_BoardItems > primary key
fk_BoardRevisionId > relationship with BoardRevision

BoardRevisions:
id_BoardRevisions > primary key
fk_BoardTypeId > relationship with BoardType
BoardRevisionNumber > varchar eg 01

BoardTypes:
id_BoardTypes > primary key
BoardNumber > varchar eg 001
BoardName > varchar eg FooBoard

valuelists.ini
[Board_Listing]
; This lookup is used for assigning a Board to a piece of equipment
__sql__ = "SELECT C.id_BoardItems, concat(A.BoardNumber, '-', B.RevisionNumber, '-', A.BoardName, ' - ', C.BoardSerialNumber) AS Board FROM BoardTypes A, BoardRevisions B, BoardItems C Where B.fk_BoardTypeId = A.id_BoardTypes AND C.fk_BoardRevisionId = B.id_BoardRevisions ORDER BY A.BoardNumber, B.RevisionNumber, C.BoardSerialNumber"

Each real world "Board" can be of a specific "Revision" of a specific "Board Type"
so the drop down list gets filled with something like
XXX-YY-BlaType-ZZZZ

This is probably pretty difficult(impossible within the framework) but... I'd like to filter what is available in the drop down list in 2 stages if possible..
There would be 3 drop down boxes in total
First would allow the user to select the "Board Type" and the second one the "Board Revision" (filtered based on what revisions are available for the previously selected board type).
This would provide a filtered list in the final drop down that would list the available serial numbers for that Board Type/Revision.

I'm not really sure how best to tackle this.
There are some javascript examples showing dynamic filtering of drop down lists but I'm not sure exactly how I can hook something like that into the "add existing" form...

We've also used some submit methods generated by onchange handlers to perform a submit without setting a "save" flag and then had the php regenerate the drop down lists based on the submitted information.. But again not sure how I'd put something like that into the framework? also not sure If I can create the three separate drop down boxes on the same form??

Any hints would be appreciated.

Cheers
Richard
rtresidd
 
Posts: 14
Joined: Sun Aug 19, 2012 8:23 pm

Re: Search/Filter on add existing record

Postby shannah » Sat Sep 08, 2012 10:19 am

In cases where the built-in actions don't do exactly what you want (e.g. in this case), I usually just create a custom action that does exactly what I want. That way you have infinite flexibility.
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 22 guests

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