I'm using jqgrid on clienside for a financial web app where rows get added and/or updated very frequently (every few ms). Max number of rows always stays under 80. data gets pushed to the web through comet (reverse ajax) when data comes in, the following code is applied
update the jqgrid is defined this way:
jQuery(selector).jqGrid(
{
datatype: 'local',
localReader: {
id: "id"
},
colNames: ["id","price","volume","time"],
colModel: [ {name:'id', width:60},
{name:'price', width:80,
align:"right",sorttype:"float"},
{name:'volume', width:100},
{name:'time',index:'amount', width:80}
],
sortname: '',
sortorder: 'desc',
height:'100%',
rowNum: 80,
viewrecords: true,
loadonce: true
});
........................
_updateGrid: function (handle, args) {
var updated = args.data;
var current = handle.jqGrid('getRowData', updated.id);
if (typeof current.id == 'undefined' || current.id == null
|| current.id == "") {
current = updated;
var itWorks = handle.addRowData(updated.id, current);
}
else {
handle.jqGrid('setRowData', updated.id,
{
id: updated.id
, price: updated.price
, volume: updated.volume
, time: updated.time
});
}
handle.sortGrid('price', false, 'desc');
}
right now the performance are very bad, so bad that firefox pops-up an error message requesting to stop the script.
I'm thinking of switching of grid widget, but before I would like to see if other developers have any idea that could solve the issue.