我有Dojo Lazy Tree Grid。我试图通过Ajax更改网格上的数据,而不是提交页面。
dojo.require("dojox.grid.LazyTreeGrid");
dojo.require("dojox.grid.LazyTreeGridStoreModel");
dojo.require("dojo.data.ItemFileWriteStore");
dojo.require("dojox.data.QueryReadStore");
dojo.require("dojo.parser");
dojo.require("dijit.form.DateTextBox");
dojo.require("dojox.grid.cells.dijit");
var store = "";
var qty1 = "";
var grid ;
dojo.ready(function(){
qty1 = document.getElementById("qty1").value;
if(qty1!="")
store = new dojox.data.QueryReadStore({url: "serverdata.jsp?firsttimeload=false" });
else
store = new dojox.data.QueryReadStore({url: "serverdata.jsp?firsttimeload=true" });
var model = new dojox.grid.LazyTreeGridStoreModel({
store: store,
serverStore: true,
childrenAttrs: ['children']
});
var layout = [
{name: 'Qty1', field: 'Qty1', width: '20%'},
{name: 'Qty2', field: 'Qty2', width: '10%',formatter: openHyperlink}
];
grid = new dojox.grid.LazyTreeGrid({
id: 'grid',
treeModel: model,
structure: layout,
openOnClick:true,
rowSelector: '20px',
canSort:false,
rowsPerPage:'500'
}, document.createElement('div'));
/* append the new grid to the div */
dojo.byId("gridDiv").appendChild(grid.domNode);
/* Call startup() to render the grid */
grid.startup();
function search()
{
qty1 = document.getElementById("qty1").value;
if(qty1!="" )
{
grid._clearData();
grid._size = 500;
grid.rowsPerPage = 500;
grid.updateRowCount(500);
grid._updateRenderedRows();
var jsonurl = "serverdata.jsp?firsttimeload=false&qty1="+qty1;
grid.setStore(new dojox.data.QueryReadStore({url: jsonurl}));
grid._fetch(0, true);
grid.refresh();
}
else
{
alert("Please enter atleast one search term");
}
}
var openHyperlink = function(value, idx, level){
return '<a href="#">'+value+'</a>';
}
当我点击搜索时,我调用搜索(),我想要刷新网格。 但是当我将rowsPerPage保持为500时。浏览器本身停止响应几分钟。我得到一个脚本没有响应。我的方式是以正确的方式刷新网格的内容吗? 请协助。