Select to view content in your preferred language

Programmatically Manipulate dijit.form.FilteringSelect

2159
1
09-24-2010 12:44 PM
KeithSandell
Regular Contributor
OnLoad I programmatically create two (2) combined FilteringSelect menus:

The first filters the seceond.

new dijit.form.FilteringSelect({store: new dojo.data.ItemFileReadStore({data: claimsYearJson}),
autoComplete: true,
style: "width: 95px;",
id: "yearOf",
onChange: function(yearOf){dijit.byId('stormName').query.yearOf = yearOf;}}, "yearOf");
                
new dijit.form.FilteringSelect({store: new dojo.data.ItemFileReadStore({data: claimsStormNameJson}),
autoComplete: true,
query: {yearOf: "*"},
style: "width: 155px;",
id: "stormName"
}, "stormName");


This works great as a means to set my Feature Layer selection On Demand.

However, another component of my application programmatically changes the "displayedValue" of the menus upon user click, which works as expected.

What doesn't work is that when the 'displayedValue' is changed progammatically the second menu displays an erroneous message saying, "The Value Entered Is Not Valid."

I believe this is because while the 'displayedValue' values have been changed the filtering query of the first is not fired off (onChange) because this is done programmatically and hence it sees a new value in the menu that does not match the most recent manual onChange query results.

Does anyone know how to programmatically fire off the onChange event?
0 Kudos
1 Reply
KeithSandell
Regular Contributor
I did some Googling for a solution and found that to programmatically fire off the onchange() event all I needed to do was get the DOM element and do, " .onchnage();"

However, for some reason while that did not cause any errors it also did not fire off the code that is natively part of the onchange function.

So I implanted a copy of the query from the element into the function that causes the values to programmatically change and presto...

No more error!
0 Kudos