我有超过1000行通过jqGrid填充数据。当我通过jqGrid填充数据时,jqGrid花费超过20秒来填充数据。此时间仅由jqGird执行(查询执行时间和其他时间除外)。我有一个要求,通过使用jqGrid填充1000行,我不想使用分页。请帮助我如何提高jgGrid的性能。如何提高jqGrid的性能
我们使用的版本是: jgGrid:3.6.4 jQuery的:1.4.2 jQuery用户界面:1.7.2 浏览器:IE 7
以下是代码:
jQuery("#displayItemPerformanceGrid").jqGrid({
//datatype: displayItemPerformanceGridData, //json
url:'/DISMGMT/StandardProxy/displayItemPerformanceService?userRole='+userRole+
'&userName='+userName+'&duration='+displayDuration+'&userId='+userId,
datatype: 'json',
colNames: ["CM","Display Location","Display Name","Item","Item Description",
"Store","DC","Date","Type","Promo Retail","Reg. Retail 50" "Units",
"Sales $", "Profit $"],
// $("#load_navGrid").html("Loading...").show();
colModel: [
{name:"cmName",index:"cmName",classes:"metric",width:130,resizable:true,
align:"left"},
{name:"displayLocation",index:"displayLocation",width:80,align: "left"},
{name:"displayName",index:"displayName",width:225,align:"left"},
{name:"item",index:"item",sorttype:"int",width:60,align:"left"},
{name:"itemDescription",index:"itemDescription",width:230,align:"left"},
{name:"store",index:"store",sorttype:"int",width: 70,align: "right"//,
//unformat : spaceFormatter
},
{name: "dc", index: "dc", sorttype: "int",width: 60,align: "right"//,
//unformat : spaceFormatter
},
{name:"date",index:"date",sorttype:"date",datefmt:"mm-dd-yy",width:80,
align: "left"},
{name: "type",index: "type",width: 45,align: "left"},
{name: "price",index: "price",width: 70,align: "left"},
{name: "regRetail",index: "regRetail",width: 70,align: "left"},
{name:"units",index:"units",sorttype:"int",width:45,align:"right",
unformat : spaceFormatter},
{name:"sales",index:"sales",sorttype:"int",width:45,align:"right",
unformat : spaceFormatter},
{name:"profit1",index:"profit1",sorttype:"int",width:40,align:"right",
unformat : spaceFormatter}
],
width: 982,
height: 137,
toolbar: [true, "top"],
viewrecords: true,
rowNum: 1500,
// gridview:true,
loadonce:true
});
请提示我如何提高jqGrid的性能
您是否也可以包含`spaceFormatter`和`metric` CSS的代码。为什么你评论了'gridview:true`这一行?它应该提高性能。顺便说一句,`align:“left”`设置是默认设置,可以从所有列定义中删除。你能提供任何测试数据来填补网格吗?如果将JSON数据保存在像test.json这样的文本文件中,并将`url`值替换为`test.json`,则可以在没有服务器组件的情况下测试网格。 – Oleg 2010-12-07 12:04:26