如何提高jqGrid的性能 [英] How to improve performance of jqGrid
问题描述
我有1000多个行可以通过jqGrid填充数据.当我通过jqGrid填充数据时,jqGrid会花费20秒钟以上的时间来填充数据.此时间仅由jqGird占用(不包括查询执行时间和其他时间).我需要使用jqGrid填充1000行,但我不想使用分页.请帮助我如何提高jgGrid的性能.
I have more than 1000 rows to populate data through jqGrid. When I populate data through jqGrid, jqGrid takes more than 20 seconds to populate data. This time is taken only by jqGird (query execution time and other time is excluded). I have a requirement to populate 1000 rows by using jqGrid and I don't want to use Pagination. Please help me how to increase the performance of jgGrid.
我们使用的版本是: jgGrid:3.6.4 的jQuery:1.4.2 jQuery UI:1.7.2 浏览器:IE 7
The versions we are using are: jgGrid: 3.6.4 jQuery:1.4.2 jQuery UI:1.7.2 Browser: 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的性能
Please suggest me how to improve performance of jqGrid
推荐答案
使用虚拟滚动(请查看 demo ,3.7版的新功能->虚拟滚动).
Use virtual scrolling (look at the demo, New in version 3.7 -> Virtual scrolling).
这篇关于如何提高jqGrid的性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!