Why can't multiple programmatically generated FilteringSelect's share a single store?

Posted by yarmiganosca on Stack Overflow See other posts from Stack Overflow or by yarmiganosca
Published on 2010-05-07T20:10:28Z Indexed on 2010/05/07 20:18 UTC
Read the original article Hit count: 135

Filed under:
|
|

Before you ask, a MultiSelect wouldn't really be intuitive for the user in this instance.
I have an object, with an array as its value for 'items', that's provided on the page in a var statement. I also have a function that generates and places dijit.form.FilteringSelects and is triggered on a certain button's click event. Every one of these selects should have the aformentioned object as their 'store' attribute. If I write store: new dojo.data.ItemFileReadStore({ data: object_name }), in my select initialization code, I get weird behavior:
I click the generate button 2 times and get 2 FilteringSelects (call them A,B). I click on B's dropdown piece, and the menu appears attached to B. Then I click on A's dropdown button, and menu appears attached to A. If I then go back and click on B's dropdown button again, nothing happens (well not nothing; an error gets thrown).
However, if instead, I have data: {items: array_literal} everything works fine, and I switch back and forth between the 2 as much as I want.
As the data: statement appears once in the javascript code, this isn't a big deal (now that I have a workaround at least). It is however, exceedingly odd. I attempted to dig into the source code, to no avail.
Anybody have any idea what's going on here?

© Stack Overflow or respective owner

Related posts about dojo

Related posts about dijit