views:

33

answers:

1

I have been trying to use the query functionality of the ItemFileReadStore to filter the list of a select widget's selectable options and it seems that my queries are having no effect on the widget. The query is being done through the onChange event of another select widget, my objective is that when one widget selects a value the other one no longer contains that value as an option). This seemed fairly simple looking at the "Codependent FilteringSelect/ComboBox widgets" example at dojo's docs site. But following this example has left me with no results. My widget that I am trying to use is below:

var sel1 = new dijit.form.Select({
                id:"sel1",
                name: "sel1",
                required: true,
                style: "width: 170px;",
                query: {value: "*" },
                store: selStore
        },"sel1");

I also have another widget sel2 which is similar and uses the same store. My 'onChange' event for both has the following code:

 dojo.connect(element, 'onChange', function(event){
                            dojo.forEach([sel1, sel2], function(element){
                                    if(element.getValue() !== event){
                                            element.attr("query", "{value: !" + event + "}");
                                            console.log("querying", element, element.query);
                                            element.store.fetch();
                                    }
                            });

As a result of this the console printout I get returns the correct element and the element.query is of the form: {value: !val1}, but nothing is being altered in the dropdown of either of the select widgets. If anyone could be of any assistance it would be very much appreciated. Thank you