700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > jgGrid pivot reload重新加载及刷新数据

jgGrid pivot reload重新加载及刷新数据

时间:2020-11-01 08:52:53

相关推荐

jgGrid pivot reload重新加载及刷新数据

1.当使用jqGrid进行多维表时,reload方法会不停的重复增加标题的行数。

解决办法:直接删除jqGrid,重新初始化页面。

function query(){//crossTable pivot不能用新数据去reload,只能重新初始化和生成jqgrid$("#showReport div").remove();$("#showReport").append("<table id='jqGridList'></table>");$("#showReport").append("<div id='pager2'></div>");pageInit(newJson);}

2.初始化方法

function pageInit(jsonArray){$("#jqGridList").jqGrid('jqPivot', jsonArray,//'<%=basePath%>js/data/data_copy.json',// pivot options{xDimension : [{dataName: 'group', width:90},{dataName: 'name'}],yDimension : [{dataName: 'country',width:130}],aggregates : [{ member : 'amount', aggregator : 'sum', width:130,label:'合计汇总',formatter:'integer',align:'right',summaryType: 'sum'},{ member : 'amount', aggregator : 'count', width:100,label:'Count',formatter:'integer',align:'right',summaryType: 'sum'}],colTotals: true,rowTotals: true}, // grid options{width: 1000,rowNum : 10,pager: "#pager2",caption: "Rows grouping"});

};

3.数据:

var newJson=[ {"CategoryName" : "Beverages","ProductName" : "Steeleye Stout","Country" : "UK","Price" : "1008.0000","Quantity" : "65"}, {"CategoryName" : "Beverages","ProductName" : "Laughing Lumberjack Lager","Country" : "USA","Price" : "140.0000","Quantity" : "10"}, {"CategoryName" : "Beverages","ProductName" : "Lakkalik\u00f6\u00f6ri","Country" : "USA","Price" : "2160.0000","Quantity" : "120"}, {"CategoryName" : "Beverages","ProductName" : "Guaran\u00e1 Fant\u00e1stica","Country" : "USA","Price" : "436.5000","Quantity" : "97"}, {"CategoryName" : "Beverages","ProductName" : "Ipoh Coffee","Country" : "UK","Price" : "1656.0000","Quantity" : "36"}];

4.html

<body><table><tr><td id="showReport" colspan="2"><table id="jqGridList"></table> <div id="pager2"></div></td></tr></table></body>

5.页面效果

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。