[英]JQGrid hide column and sorting in grouping
I have tried hidden: true, width: 0, display: false but still I see the column in the grid.我试过 hidden: true, width: 0, display: false 但我仍然看到网格中的列。 Than I tried
比我试过的
myGrid.jqGrid('hideCol', ["Type"]); myGrid.jqGrid('hideCol', ["Type"]);
issue 1:问题1:
which is working and column is hidden but once I show collapsed rows than this column is again visible.它正在工作并且列被隐藏,但是一旦我显示折叠的行,该列就会再次可见。
issue 2:问题2:
I have groupCollapse: true.我有 groupCollapse: true。 When I uncollapse and do the sorting than all the rows collapsed again.
当我展开并进行排序时,所有行都再次折叠。
Problem:问题:
Collapse/UnCollapse the hidden column shouldn't visible. Collapse/UnCollapse 隐藏的列不应该可见。
When sorting rows collapse.排序行时折叠。
var myGrid = $('#list');
myGrid.jqGrid({
url: '/Admin/DynamicGridData/',
datatype: 'json',
mtype: 'POST',
colNames: ['Id', 'Date', 'First Name', 'Last Name', 'Email Address', 'Hidden'],
colModel: [
{ name: 'Id', index: 'Id', width: 40, align: "center", editable: false, editoptions: { readonly: true }, key: true, sorttype: "int", searchoptions: { sopt: ['eq', 'ne', 'lt', 'le', 'gt', 'ge']} },
{ name: 'DateEdited', index: 'DateEdited', width: 90, sorttype: "date", formatter: "date" },
{ name: 'FirstName', index: 'FirstName', width: 120, searchoptions: { sopt: ['eq', 'ne', 'lt', 'le', 'gt', 'ge']} },
{ name: 'LastName', index: 'LastName', width: 120, searchoptions: { sopt: ['eq', 'ne', 'lt', 'le', 'gt', 'ge']} },
{ name: 'Email', index: 'Email', width: 300, searchoptions: { sopt: ['cn', 'nc', 'bw', 'bn', 'eq', 'ne', 'ew', 'en', 'lt', 'le', 'gt', 'ge']} },
{ name: 'Type', index: 'Type', hidden: true, width: 0, display: false, search: false }
],
height: 'auto',
autowidth: true,
rownumbers: true,
rowNum: 30,
rowList: [10, 20, 30],
pager: '#pager',
sortname: 'Id',
viewrecords: true,
sortorder: "asc",
multiselect: true,
altRows: true,
altclass: 'myAltRowClass',
caption: "Master Grid",
jsonReader: { cell: "" },
grouping: true,
groupingView: { groupField: ['Type'],
groupColumnShow: [true],
groupText: ['<b>{0} - {1} Record(s)</b>'],
groupCollapse: false,
groupOrder: ['desc']
}
});
myGrid.jqGrid('navGrid', '#pager', { add: false, edit: false, del: true }, {}, {},
{ },
{ multipleSearch: true, overlay: false });
myGrid.jqGrid('filterToolbar', { stringResult: true, searchOnEnter: true, defaultSearch: 'cn' });
myGrid.jqGrid('navButtonAdd', '#pager', { caption: "Filter", title: "Toggle Searching Toolbar", buttonicon: 'ui-icon-pin-s', onClickButton: function () { myGrid[0].toggleToolbar(); } });
myGrid[0].toggleToolbar();
myGrid.jqGrid('hideCol', ["Type"]);
You can use either你可以使用
myGrid.jqGrid('hideCol', "Type");
instead of myGrid.jqGrid('hideCol', ["Type"]);
而不是
myGrid.jqGrid('hideCol', ["Type"]);
or use或使用
groupColumnShow: [false]
instead of groupColumnShow: [true]
because you want hide the column on which you do grouping.而不是
groupColumnShow: [true]
因为你想隐藏你进行分组的列。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.