Forum
03:48
29/07/2008
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 :
var addAllRawData = function(data,t) {
if(data) { var fpos = ts.p.treeANode; if(fpos===0) {$("tbody tr:gt(0)", t).remove();} } else { return; }
var row,f=[],cur,gi=0,si=0,drows,idn,rd=[],cn=(ts.p.altRows===true) ? 'alt':'';
f = reader("json");
drows = data;
if (drows) {
ts.p.records=drows.length;
for (var i=0;i<drows.length;i++) {
cur = drows[i];
row = document.createElement("tr");
row.id = i+1;
if(ts.p.multiselect){
addMulti(t,row);
gi = 1;
}
if (ts.p.subGrid) {
try { $(ts).addSubGrid(t,row,gi,drows[i]);} catch (e){}
si= 1;
}
for (var j=0;j<f.length;j++) {
addCell(t,row,cur[f[j]] || ' ',j+gi+si);
rd[ts.p.colModel[j+gi+si].name] = cur[f[j]];
}
if(i%2 == 1) {row.className = cn;} $(row).addClass("jqgrow");
if( ts.p.treeGrid === true) {
try {$(ts).setTreeNode(rd,row);} catch (e) {}
}
$(ts.rows[i+fpos]).after(row);
if(afterInsRow) {ts.p.afterInsertRow(row.id,rd,drows[i]);}
rd=[];
}
}
data = null;
if(isSafari || isOpera) {resizeFirstRow(t,1);}
if(!ts.p.treeGrid) {ts.grid.bDiv.scrollTop = 0;}
endReq();
updatepager();
};
and then, at the end of the same file :
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
11:44
Moderators
30/10/2007
Hello,
Thank you for this code. I will look at it.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
64 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66