I changed ItemFileReadStore for combobox in Dojo. My code looks something like
<span dojoType="dojo.data.ItemFileReadStore"
jsId="comboStore"
data="transformData">
<select dojoType="mywidget.DropDown" id="transformCombo" value="" store="comboStore" searchAttr="name" name="state" maxHeight="100"/>
我的小部件类似于道场组合框控件。我改变transformData但组合框不更新,直到页面完全重新装入。你知道吗?
My widget is similar to dojo combobox widget. I changed transformData but the combobox is not updated until the page is entirely reloaded again. Any idea?
推荐答案
如果内容是不断变化的服务器端,你只是想刷新它的本地副本无需重新加载页面,你可以叫取
在商店,当你收到新的数据更新您的组件。
If 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 component when you receive the new data.
下面是我用来刷新当服务器端的内容被更新dojox.grid.DataGrid的code:
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();
}
});
如果您正在修改的数据客户端,你或许应该使用ItemFileWriteStore为安德烈建议。
If you are modifying the data client side, you should probably be using ItemFileWriteStore as Andrei suggested.
编辑:
grid.sort()
可用于刷新一个DataGrid作为替代 grid._refresh()
(谁的行为可能随时间改变)
grid.sort()
can be used for refreshing a DataGrid as an alternative to grid._refresh()
(who's behaviour may change over time)
相关推荐
最新文章