你也可以重置查询以便再次执行。按照为了设定该页面的教程:http://dojotoolkit.org/documentation/tutorials/1.7/store_driven_grid/
在示例数据网格与存储在存储器中:
require(["dojox/grid/DataGrid", "dojo/data/ObjectStore", "dojo/store/Memory", "dojo/domReady!"],
function (DataGrid, ObjectStore, Memory) {
var formsList = [
{id:1, name:"Jim", department:"accounting"},
{id:2, name:"Rosenblumentalovitsch", department:"engineering"},
{id:3, name:"Mike", department:"sales"},
{id:4, name:"John", department:"sales"}
];
formStore = new Memory({data:formsList, idProperty:"id"});
formGrid = new DataGrid({
store:dataStore = ObjectStore({objectStore:formStore}),
query: {id: "*"} ,
structure:[
{ name:"Form", field:"name", width:"100%" }
]
}, "grid");
formGrid.startup();
});
增加了formStore
中的元素的数据网格不会自动刷新时。下面是刷新的addForm功能:()
function addForm(evt) {
// set the properties for the new item:
var myNewItem = {id:5, name:"Jim 2", department:"accounting"};
// Insert the new item into the store:
formStore.add(myNewItem);
formGrid.setQuery({id: "*"}); //this row executes the query again, thus refreshing the data grid
}
不是为我工作在IE8 – 2013-06-27 17:13:32