Forum


17:16

04/06/2010

I am getting an unresponsive script warning from firefox when loading 2,000 records. Is this abnormal, or
is this the expected performance when loading 2,000 records and I should increase max_script_runtime ?
I am using version 3.6
I did not get this error using tablesorter, but JQGRid has features I need that are missing in tablesorter please help!
The cells are populated with some low digit numbers.
Here is the relevant code:
jQuery("#myTable").jqGrid({
datatype: "local",
colNames:['Select','State Number 1', 'State Number 2', 'eHars StNo 1','eHars StNo 2','Match Weight'],
colModel:[
{name:'Select',index:'Select',sortable:false},
{name:'StateNumber1',index:'StateNumber1'},
{name:'StateNumber2',index:'StateNumber2'},
{name:'eHarsStNo1',index:'eHarsStNo1'},
{name:'eHarsStNo2',index:'eHarsStNo2'},
{name:'MatchWeight',index:'MatchWeight'},
],
multiselect: false,
height: "70%",
autowidth: true,
altClass: 'altRow',
altRows: true,
pager : '#gridpager',
pgbuttons: false,
pginput: false,
caption: "Click on the first State Number in the pairs of statenos below to combine"
}).navGrid('#gridpager', {
refresh:true,
refreshtitle:"Refresh Table Data",
search:false,
edit: false,
add:false,
del:false
});
var mydata = [
stuff to make data.....
]
{Select:"<input type='radio' name='merge' onClick='goToMergeCheck()'><input type=hidden name=stateNo1 value='<%=stateNo1%>'><input type=hidden name=stateNo2 value='<%=stateNo2%>'",StateNumber1:"<%=stateNo1%>",StateNumber2:"<%=stateNo2%>",eHarsStNo1:"<%=eHarsNo1out%>",eHarsStNo2:"<%=eHarsNo2out%>",MatchWeight:"<%=HTML.formatForTD(matchKey)%>"},
]; for(var i=0;i<=mydata.length;i++) jQuery("#myTable").jqGrid('addRowData',i+1,mydata[i]);
17:41

Moderators
30/10/2007

Hello,
1. You have a error in the script:
colModel:[
{name:'Select',index:'Select',sortable:false},
{name:'StateNumber1',index:'StateNumber1'},
{name:'StateNumber2',index:'StateNumber2'},
{name:'eHarsStNo1',index:'eHarsStNo1'},
{name:'eHarsStNo2',index:'eHarsStNo2'},
{name:'MatchWeight',index:'MatchWeight'}, <=== This is wrong
],
2. addRowData can load the data at once. More info here:
http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods
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.
20:24

04/06/2010

Thank you for the fast response. I removed the comma.
I am a little confused as how to load the data all at once, I am assuming you mean with one call to 'addRowData' instead
of one at a time with a for loop right?
I looked at the link you sent me and it appears that I have the data object in the specified format of
[{name1:value1,name2: value2…}, {name1:value1,name2: value2…} ]
Here is what is in the view source of my page:
<table id="myTable"></table>
<div id="gridpager"></div>
<script>
jQuery("#myTable").jqGrid({
datatype: "local",
colNames:['Select','State Number 1', 'State Number 2', 'eHars StNo 1','eHars StNo 2','Match Weight'],
colModel:[
{name:'Select',index:'Select',sortable:false},
{name:'StateNumber1',index:'StateNumber1'},
{name:'StateNumber2',index:'StateNumber2'},
{name:'eHarsStNo1',index:'eHarsStNo1'},
{name:'eHarsStNo2',index:'eHarsStNo2'},
{name:'MatchWeight',index:'MatchWeight'}
],
height: "70%",
autowidth: true,
altClass: 'altRow',
altRows: true,
caption: "Click on the first State Number in the pairs of statenos below to combine"
});
var mydata = [
{Select:"<input type='radio' name='merge' onClick='goToMergeCheck()'>
<input type=hidden name=stateNo1 value='0010000697'>
<input type=hidden name=stateNo2 value='0010019495'",
StateNumber1:"0010000697",StateNumber2:"0010019495",eHarsStNo1:" ",eHarsStNo2:" ",
MatchWeight:"2.00"},
.............................2,000 repetitions of this....................
{Select:"<input type='radio' name='merge' onClick='goToMergeCheck()'>
<input type=hidden name=stateNo1 value='0010022777'>
<input type=hidden name=stateNo2 value='0010022587'",StateNumber1:"0010022777",
StateNumber2:"0010022587",eHarsStNo1:" ",eHarsStNo2:" ",MatchWeight:"2.00"},
];
jQuery("#myTable").jqGrid('addRowData',mydata);
I am assuming I am using 'addRowData' incorrectly now but
no javascript error is shown.
The table is just blank now.
Thanks again.
13:24

Moderators
30/10/2007

Hello,
If you try with not so much rows - let say 200-300 is this happen?
Best 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.
20:40

04/06/2010

Thank you for the reply Tony.I was able to fix this problem.
200-300 records load just fine. It starts to hit the tiomeout
depending on the user after about 1,500 records.
I finally figured out how to add the records all at once as you suggested. This did help
quite a bit, with about a 30% increase in performance. Unfortunately the timeout was
still being triggered on some machines. And since there could be 4,000+ records at
some points, that wouldn't work for me.
So what I did was instead of sending down 1 large javascript call, I broke each row addition
into its own javascript call and then flushed the browser cache. This way each call is only a fraction
of a second and the timeout will never be triggered even if you loaded 50,000 rows. This is
the relevent code:
jQuery("#myTable").jqGrid({
datatype: "local",
colNames:['Select','State Number 1', 'State Number 2', 'eHars StNo 1','eHars StNo 2','Match Weight'],
colModel:[
{name:'Select',index:'Select',sortable:false},
{name:'StateNumber1',index:'StateNumber1'},
{name:'StateNumber2',index:'StateNumber2'},
{name:'eHarsStNo1',index:'eHarsStNo1'},
{name:'eHarsStNo2',index:'eHarsStNo2'},
{name:'MatchWeight',index:'MatchWeight'}
],
height: "70%",
autowidth: true,
altClass: 'altRow',
altRows: true,
caption: "Click on the first State Number in the pairs of statenos below to combine"
});
</script>
while (rs.next() ){
<script>
jQuery("#myTable").jqGrid('addRowData',i,{Select:"<input type='radio' name='merge' onClick='goToMergeCheck()'><input type=hidden name=stateNo1 value='<%=stateNo1%>'><input type=hidden name=stateNo2 value='<%=stateNo2%>'",StateNumber1:"<%=stateNo1%>",StateNumber2:"<%=stateNo2%>",eHarsStNo1:"<%=eHarsNo1out%>",eHarsStNo2:"<%=eHarsNo2out%>",MatchWeight:"<%=HTML.formatForTD(matchKey)%>"});
i++;
</script>
<%out.flush();%>
}
This caused the table to visibly grow as it loaded. I prefer to only show the table when it is ready so I had
the table hidden and a javascript please wait animation shown while it was loaded. Then at the end of the page
I changed the table div to blocked. Works great and I tested with 9,000 records.
I want to mention a couple of things. A couple of the grid options destroy the loading performance.
with this option: rownumbers: true;
or
pager : '#gridpager',
pgbuttons: false,
pginput: false,
viewrecords: true,
recordtext: "Total Records: <font style='color:red'>{2}</font>",
Will make the table load much, much slower. Without those options 3,000 records
will take about 14 seconds to load. With those options on it will take about 8 minutes.
In my case I just wanted the pager there to display the total number of records.
I removed number being loaded and just had a straight text string of "this is a test"
in there and it was still just as slow. Just wanted to give you a heads up.
Thanks for all your hard work on this. Now that I have the timeout issues resolved
my users are loving jqgrid.
Most Users Ever Online: 715
Currently Online:
54 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