#9694 closed enhancement (fixed)
Public API to change ItemFileReadStore url
Reported by: | Josh Trutwin | Owned by: | Jared Jurkiewicz |
---|---|---|---|
Priority: | high | Milestone: | 1.4 |
Component: | Data | Version: | 1.3.2 |
Keywords: | dojo.data.ItemFileReadStore clearOnClose | Cc: | |
Blocked By: | Blocking: |
Description (last modified by )
Per #6073 there is a clearOnClose param since 1.2 that allows a data store to change URL's without having to create a new store. But for this to work you have to set a psuedo-private member of the class:
<div id="store" dojoType="dojo.data.ItemFileReadStore" clearOnClose="true" url="/foo.php">
then:
dijit.byId("store")._jsonFileUrl = "/bar.php"; dijit.byId("store").close(); dijit.byId("store").fetch();
Would it be possible to replace the first line with something like:
dijit.byId("store").setUrl("/bar.php");
Or even:
dijit.byId("store").attr('url', '/bar.php');
Thanks,
Josh
Change History (5)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Description: | modified (diff) |
---|
comment:3 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
This is already provided as of Dojo 1.4: http://bugs.dojotoolkit.org/ticket/9303
As for the secondary request for dijit.attr, that cannot be used. dijit.byId() works for widgets (classes that extend from dijit._Widget). None of the datastores extend from that class, they are not visual widgets, and therefore are not addressable by dijit.ById?(), nor would they have the attr function of dijit._Widget subclasses.
Anyway, long-winded comment on the dijit.ById? part, but as for setting the URL ,you already can:
storeInstance.url = <whatever>
The code has logic to trap that being reset, and if clearOnClose is true and close() was called, the new url value will be used.
So, already fixed.
comment:4 Changed 11 years ago by
Thanks for the nice comment - should've searched the bug database first. :(
Is .fetch(); needed still to automatically update the store after changing .url?
comment:5 Changed 11 years ago by
Milestone: | tbd → 1.4 |
---|
The store will reload on the next call to fetch, either by a widget invoking it normally (As would ComboBox?, FilteringSelect?, etc, or by setting the query on grid, etc.).
oops - please add code formatting wiki tags...