ajax - Dojo Lazy Tree Grid - Change Data on the Grid on Demand -
i have dojo lazy tree grid. trying change data on grid ajax, rather submitting page.
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 new grid div */ dojo.byid("griddiv").appendchild(grid.domnode); /* call startup() render 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 1 search term"); } } var openhyperlink = function(value, idx, level){ return '<a href="#">'+value+'</a>'; }
when click search, call search(), want refresh grid. when keep rowsperpage 500. browser stops responding few minutes. script not responding. way of refreshing contents of grid right way it? please assist.
Comments
Post a Comment