[Dojo-interest] Help Changing dynamically store
Jamey Graham
jameyg228 at yahoo.com
Fri Aug 5 16:17:11 EDT 2011
first, does "dojoAttachPoint" in data-dojo-props actually work? I believe the new preferred way is actually:
<input data-dojo-type="dijit.form.FilteringSelect" data-dojo-attach-point="costCenter" data-dojo-props="searchAttr:'caption', store:frequencyStore">
but assuming that itself isn't the issue, a couple of notes:
- this.costCenter.set('store', this.sourcesStore) is all you need to do to wire the FilteringSelect up to a new store. For giggles, this can also be (just a different style since order the "setters" get called probably doesn't matter here):
this.costCenter.set({
store: this.sourcesStore,
searchAttr: 'node_name' // is this intentionally a hardcoded literal?
});
- i'm not entirely sure what you're looking to accomplish w/ the this.sourcesStore.fetch(), but it won't have any affect on the costCenter FS. A possible source of confusion here relates to the difference between a "resultset" (the result of a fetch() call) vs. the store itself...FS doesn't operate on resultsets...it operates on the store (generating it's own resultsets by calling fetch() or getItemByIdentity())).
- if you're instead just calling fetch() to find some sort of "default" value for the FS, then note that you can actually call FS.set('item', item) instead of something like FS.set('value', item.id)
NOTE that there's some oddball behavior re: FilteringSelect when changing stores and the store's validity...I think the workaround is something like FS.set('item', null) before switching stores (i could be wrong...i just remember that when i thought a FS should be invalid it wasn't).
curiously, what version of Dojo are you using? "query" suggests the new store API, but I thought the use of something like dojo.store.Memory as the FS.store won't be supported until 1.7.
>________________________________
>From: Jean-Rubin Leonard <jrleonard at gmail.com>
>To: dojo-interest at mail.dojotoolkit.org
>Sent: Friday, August 5, 2011 2:41 PM
>Subject: [Dojo-interest] Help Changing dynamically store
>
>
>Hi guys, I have the following filteringSelect in a template:
> <input data-dojo-type="dijit.form.FilteringSelect" data-dojo-props=" dojoAttachPoint:'costCenter', searchAttr:'caption', store:frequencyStore">
>
>I want the fs to be created in the template as to control its position in the flow of things (I have several other widgets on a line).
>The url of the store for the filtering select is dynamic and depends on what the user has selected. I do not know it and advance and cannot therefore use a hardcoded url for the store. In order to be able to create the filteringSelect I pass it a store (frequencyStore, above) that I dont really need. My goal is to change the store dynamically in the filteringSelect parent's _setValueAttr.
>I therefore do the following:
> this.costCenter.set('store',this.sourcesStore);
> this.costCenter.set('searchAttr','node_name');
> this.sourcesStore.fetch({onComplete : dojo.hitch(this,'assignCcValue',value)});
>But it doesnt work. There are no value selected in the fs, when I try to use it i get an error message: '_this.store.query is not a function;'.
>
>Anyone can tell me what I'm doing wrong? What's the proper way to change a filteringSelect on the fly?
>
>Thanks for any advice.
>JR
>
>________________________________________________________
>Dojotoolkit: http://dojotoolkit.org
>Reference Guide: http://dojotoolkit.org/reference-guide
>API Documentation: http://dojotoolkit.org/api
>Tutorials: http://dojotoolkit.org/documentation
>
>Dojo-interest at mail.dojotoolkit.org
>http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-interest/attachments/20110805/056fe4cc/attachment.htm
More information about the Dojo-interest
mailing list