Hi Tony,
just wanted to let you know that i added a function to the grid.base.js script, because i our current project, there is no way to get the json data formatted.
Instead, it all comes in one block, without any header. The disadvantage is that paging isn't posible, but this function allowed us to load a very large amount of data within a much tinyer time than adding rows one by one.
line 789, I added the following :
|
1 |
<br />var addAllRawData = function(data,t) {<br /> if(data) { var fpos = ts.p.treeANode; if(fpos===0) {$("tbody tr:gt(0)", t).remove();} } else { return; }<br /> var row,f=[],cur,gi=0,si=0,drows,idn,rd=[],cn=(ts.p.altRows===true) ? 'alt':'';<br /> f = reader("json");<br /> drows = data;<br /> if (drows) {<br /> ts.p.records=drows.length;<br /> for (var i=0;i<drows.length;i++) {<br /> cur = drows<i>;<br /> row = document.createElement("tr");<br /> row.id = i+1;<br /> if(ts.p.multiselect){<br /> addMulti(t,row);<br /> gi = 1;<br /> }<br /> if (ts.p.subGrid) {<br /> try { $(ts).addSubGrid(t,row,gi,drows</i><i>);} catch (e){}<br /> si= 1;<br /> }<br /> for (var j=0;j<f.length;j++) {<br /> addCell(t,row,cur[f[j]] || ' ',j+gi+si);<br /> rd[ts.p.colModel[j+gi+si].name] = cur[f[j]];<br /> }<br /> if(i%2 == 1) {row.className = cn;} $(row).addClass("jqgrow");<br /> if( ts.p.treeGrid === true) {<br /> try {$(ts).setTreeNode(rd,row);} catch (e) {}<br /> }<br /> $(ts.rows[i+fpos]).after(row);<br /> if(afterInsRow) {ts.p.afterInsertRow(row.id,rd,drows</i><i>);}<br /> rd=[];<br /> }<br /> }<br /> data = null;<br /> if(isSafari || isOpera) {resizeFirstRow(t,1);}<br /> if(!ts.p.treeGrid) {ts.grid.bDiv.scrollTop = 0;}<br /> endReq();<br /> updatepager();<br />};<br /></i> |
and then, at the end of the same file :
|
1 |
ts.addAllRawData = function(d) {addAllRawData(d,ts.grid.bDiv);}; |
With this function, we gained a lot of time due to a processing a lot more efficient.
I hope that you could implement such a function in your next release, that would be awesome !
Greetings,
zupert
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top