我尝试按名称元素对数据进行分组,在示例(http://trirand.com/blog/jqgrid/jqgrid.html)上隐藏隐藏分组组列。怎么办?
在页面上的事实中有3列,但我想隐藏组列(名称)。
顺便说一下主折叠按钮不起作用:
<script type="text/javascript" src="js/jquery.jqGrid2.js"></script>
<script type="text/javascript" src="js/grid.locale-en.js"></script>
<script type="text/javascript" src="js/grid.treegrid.js"></script>
<script type="text/javascript" src="js/ui.multiselect.js"></script>
<script type="text/javascript" src="js/jquery.tablednd.js"></script>
var mydata = [
{elemName : "Temperature 3m", name : "Energy balance station EB1", value : 14 },
{elemName : "Humidity 3m", name : "Energy balance station EB1", value : 34 },
{elemName : "Air pressure 0.1m", name : "Energy balance station EB1", value : 540 },
{elemName : "Server room temperature", name : "Computer infrastructure", value : 28 },
{elemName : "Free disk space", name : "Computer infrastructure", value : 400 },
{elemName : "Free disk space", name : "Computer infrastructure", value : 230 },
];
$('#sumGrid').jqGrid({
data: mydata,
datatype: 'local',
height : 'auto',
rowNum : 30,
rowList : [2, 5, 10],
colNames : ["Parameter", "Group", "Value"],
colModel : [
{name : 'elemName', index : 'elemName', width : 150, sorttype: 'text', resizable: true},
{name : 'name', index : 'name', width : 100, editable : true},
{name : 'value', index : 'value', width: 150, sorttype : 'float', resizable : true, formatter : 'number'},
],
pager : '#psumGrid',
viewrecords : true,
//sortname : 'name',
grouping : true,
groupView : {
groupField : ['name'],
},
caption : "Data",
答案 0 :(得分:0)
添加选项groupColumnShow:[false] 到分组视图,如
groupingView : {
groupField : ['name'],
groupColumnShow : [false]
},