gpt4 book ai didi

jquery - jqGrid 在分组时对列进行排序考虑分组标题

转载 作者:行者123 更新时间:2023-12-03 22:58:44 25 4
gpt4 key购买 nike

我有jqgrid。我根据列值对几行进行了分组。工作演示可在 link 获取。定义 jqGrid 的部分代码

    var preclosingtable = $('#preclosing');
preclosingtable.jqGrid({
datatype: 'local',
data: data.DOCS,
colNames: ['', 'Documents Received', 'Comments', 'NA', 'DocGroup'],
colModel: [
{ name: 'Documents', index: 'Documents', align: 'left', sortable: false, editable: false, width: 20 },
{ name: 'DocsReceived', index: 'DocsReceived', align: 'center', sortable: false, editable: true, edittype: 'checkbox', editoptions: { value: "True:False" }, formatter: "checkbox", width: 140 },
{ name: 'Comments', index: 'Comments', align: 'center', sortable: false, editable: true, edittype: "textarea", editoptions: { rows: "3", cols: "16" }, width: 180 },
{ name: 'NA', index: 'NA', editable: true, formatter: 'dynamicText', width: 150, edittype: 'custom', editoptions: { custom_element: radioelem, custom_value: radiovalue} },
{ name: 'DocGroup', index: 'DocGroup', editable: false, width: 1 }
],
rowNum: data.DOCS.length,
//rowList: [10, 20, 30],
pager: '#preclosingpagerdiv',
viewrecords: true,
sortorder: "asc",
sortname: 'Documents',
grouping: true,
groupingView: {
groupField: ['DocGroup'],
groupColumnShow: [false],
groupDataSorted: true,
groupOrder : 'asc'
},
localReader: {
id: 'ConfigId'
},
shrinkToFit: false,
height: 'auto',
loadComplete: function () {
HideGroupHeaders(this);
},
onSelectRow: function (id) {
preclosingtable.jqGrid('saveRow', previouslyselectedRow, false, 'clientArray');
previouslyselectedRow = SetJQGridRowEdit(id, previouslyselectedRow, preclosingtable);
}
});

以下是我的网格的样子 jqGrid after grouping

问题:是否可以对此网格中的行进行排序,以便最终网格中的行按以下顺序排列

  • 阿拉巴马州
  • D
  • 缅因州
  • 新泽西州
  • 弗吉尼亚州

最佳答案

如果我正确理解您的问题,您可以通过在进行分组的列 DocGroup 上添加自定义排序功能(请参阅 hereherehere )来解决您的问题:

sorttype: function (cellvalue, rowObject) {
return cellvalue? cellvalue : rowObject.Documents;
}

因此,具有空 DocGroup 的输入数据将被排序,并按 Documents 分组。您将在 Fiddle 上看到结果

enter image description here

关于jquery - jqGrid 在分组时对列进行排序考虑分组标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16219944/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com