admin管理员组文章数量:1390896
I changed ItemFileReadStore for bobox in Dojo. My code looks something like
<span dojoType="dojo.data.ItemFileReadStore"
jsId="boStore"
data="transformData">
<select dojoType="mywidget.DropDown" id="transformCombo" value="" store="boStore" searchAttr="name" name="state" maxHeight="100"/>
My widget is similar to dojo bobox widget. I changed transformData but the bobox is not updated until the page is entirely reloaded again. Any idea?
I changed ItemFileReadStore for bobox in Dojo. My code looks something like
<span dojoType="dojo.data.ItemFileReadStore"
jsId="boStore"
data="transformData">
<select dojoType="mywidget.DropDown" id="transformCombo" value="" store="boStore" searchAttr="name" name="state" maxHeight="100"/>
My widget is similar to dojo bobox widget. I changed transformData but the bobox is not updated until the page is entirely reloaded again. Any idea?
Share asked Jun 5, 2011 at 16:41 SIr CodealotSIr Codealot 5,4319 gold badges36 silver badges47 bronze badges2 Answers
Reset to default 3If the content is changing server side and you just want to refresh your local copy of it without reloading the page, you can call fetch
on the store and update your ponent when you receive the new data.
Here's the code that I use to refresh a dojox.grid.DataGrid when the server side content is updated:
// initialise store and link to DataGrid
var store = new dojo.data.ItemFileReadStore({
url: "items.json",
clearOnClose: true,
urlPreventCache: true
});
var grid = dijit.byId("grid")
grid.setStore(store);
// code to update local copy
store.close();
store.fetch({
onComplete: function(items, request) {
grid._refresh();
}
});
If you are modifying the data client side, you should probably be using ItemFileWriteStore as Andrei suggested.
Edit:
grid.sort()
can be used for refreshing a DataGrid as an alternative to grid._refresh()
(who's behaviour may change over time)
How do you refresh the ItemFileReadStore? ItemFileReadStore - it's read-only datastore. In your case you should use ItemFileWriteStore. Look this question " dijit.form.filteringselect dynamically change options ". I think that's what you're looking for.
本文标签: javascriptDojoHow to refresh combobox with updated ItemFileReadStore dataStack Overflow
版权声明:本文标题:javascript - Dojo - How to refresh combobox with updated ItemFileReadStore data - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744652460a2617765.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论