how to filter the lookup results include in grid widget

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

how to filter the lookup results include in grid widget

Postby olivyeah » Sun May 30, 2010 5:50 am

Hello,
First of all, many thanks for xataface and support.
My question is how to filter "add existing" searchs results in the lookup widget of the grid widget .
Something like " widget:addexistingfilters = {contact_type: 3}" in the field.ini would be cool!
In HTML\Quickform\grid.php I found :
Code: Select all
jQuery(document).ready(function($){
     $('.xf-lookup-grid-row-button-<?php echo $fieldName;?>').each(function(){
           $(this).RecordBrowser({
               <?php if ($this->addExistingFilters):?>filters: <?php echo json_encode($this->addExistingFilters);?>,<?php endif;?>
               table: <?php echo json_encode($this->table);?>,
               callback: function(values){...

This is what i need but I can't find a clean way to use it simply...
Is someone got an idea?

Related question: the addexisting lookup widget in the grid widget only work if lookup widget is already used with another field , is it a bug or am I wrong with something ? (ver 1.2.4 1811)

thanks

--
oliv
olivyeah
 
Posts: 8
Joined: Mon May 17, 2010 1:58 pm

Re: how to filter the lookup results include in grid widget

Postby shannah » Sun May 30, 2010 11:08 pm

This feature was implemented but never tested yet so it probably doesn't work yet. I'll have to refer to the source code carefully to see how it is intended to work.

As for the lookup not working unless it's also elsewhere on the form, this would appear to be a bug. Thanks for reporting it.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: how to filter the lookup results include in grid widget

Postby shannah » Sun May 30, 2010 11:18 pm

Ok here's the syntax
Code: Select all
[myfield]
...
widget:filters:groupid=10


In this case it would filter the lookup to only show results matching group I'd 10.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: how to filter the lookup results include in grid widget

Postby olivyeah » Tue Jun 01, 2010 3:22 am

Bonjour,
Thanks for your fast answer.
It works on lookup widget but unfortunaly it don't work on the lookup that appear clicking "add existing record" in the grid widget ...

Code: Select all
[artiste_tourneur_contact]
transient = 1
widget:label = "tourneur"
widget:type = grid
widget:filters:contact_type = 3
relationship = tourneur2contact
order = 3


Don't works (lookup is not filtered)

But this works (despite this is not what i need)
Code: Select all
[artiste_tourneur_contact]
transient = 1
widget:label = "tourneur"
widget:type = lookup
widget:table=contacts
widget:filters:contact_type = 3
order = 3



Having an idea ?

best regards

--
oliv
olivyeah
 
Posts: 8
Joined: Mon May 17, 2010 1:58 pm

Re: how to filter the lookup results include in grid widget

Postby olivyeah » Sat Jul 31, 2010 4:59 pm

olivyeah wrote:...
Related question: the addexisting lookup widget in the grid widget only work if lookup widget is already used with another field , is it a bug or am I wrong with something ?
...


Just need to add :

Code: Select all
function block__custom_javascripts(){
         echo '<script type="text/javascript" src="http://eee_oliv/xataface/js/jquery-ui-1.7.2.custom.min.js"></script>';
         echo '<script type="text/javascript" src="http://eee_oliv/xataface/js/RecordBrowser/RecordBrowser.js"></script>';
         echo '<script type="text/javascript" src="http://eee_oliv/xataface/js/RecordDialog/RecordDialog.js"></script>';
   }     

in the table delegate class to have the lookup working in the grid widget.

--
oliv
olivyeah
 
Posts: 8
Joined: Mon May 17, 2010 1:58 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 14 guests

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