JQGrid groupView

时间:2017-11-30 15:24:12

标签: jquery asp.net jqgrid

是否可以将一行中的行分为两列?我有两个值来确定分组。问题是我必须只显示特定的分​​组标题。这是我的代码:

$("#grid").jqGrid({

                    data: response.d.Data.rows,

                    colModel: [
                    { name: 'RowNumber', hidden: true },
                    { name: 'ID_WorkPlace', hidden: false },
                    { name: 'WorkPlaceName', hidden: false, width: 100,} , //label: '<%= ((BPMISBasePage)Page).ResourceManager.GetString("asp.pages_limits_projectsearch_aspx_projectlist_code")%>', search: true },
                    { name: 'WorkPlaceCode', hidden: false, width: 70 } , // label: '<%= ((BPMISBasePage)Page).ResourceManager.GetString("asp.pages_limits_projectsearch_aspx_projectlist_name")%>', search: true },
                    { name: 'WorkPlaceCodeName', hidden: false, width: 70 } ,
                    { name: 'ID_ParentWorkplace', hidden: false, width: 70 } ,
                    { name: 'ParentWorkPlaceCode', hidden: false, width: 70 } ,
                    { name: 'ParentWorkPlaceCodeName', hidden: false, width: 70 } ,
                    { name: 'ParentWorkPlaceName', hidden: false, width: 70 } ,

                    { name: 'NumberOfEmployeesStayedLeft', hidden: false, width: 70 } ,
                    { name: 'ParameterPlain', hidden: false, width: 70 } ,

                    { name: 'BaseSalaryValue', hidden: false, width: 70 } ,
                    { name: 'ID_EmploymentDynamic', hidden: false, width: 70 } ,
                    { name: 'RSBaseSalary', hidden: false, width: 70 } ,
                    { name: 'TotalCoefficient', hidden: false, width: 70 } ,
                    { name: 'NumberOfMonths', hidden: false, width: 70 } ,
                    { name: 'YearlyNetSalaryByEmployee', hidden: false, width: 70 } ,
                   ],

                    gridview: true,
                    //rowNum: 19,
                    //pager: '#pager',
                    //multiselect: true,
                    viewrecords: true,
                    loadonce: true,
                    autowidth: true,
                    rowattr: function (rd) {
                        if (rd.UnRead) {
                            return { "class": "jqfoot" };
                        }
                    },
                    sortname: 'Code',
                    sortorder: 'asc',
                    headertitles: true,
                    multiSort: true,
                    ondblClickRow: function (rowid, iRow, iCol) {
                        if (rowid) {
                            odDoubleClick(rowid);
                        }
                    },
                    //altRows: true,
                    //altclass: 'jqGridAltRows',
                    searching: {
                        defaultSearch: 'cn'
                    },
                    grouping: true,
                    groupingView: {
                        groupField: ["ParentWorkPlaceCode", "RowNumber", "WorkPlaceCodeName"],
                        groupColumnShow: [true, false, false],
                        groupText: [
                            "<b>{0}</b>",
                            "<b>{0}</b>", //How to hide this?
                            "<b>{0}</b>" //I have to show only this!!!
                        ],
                        groupOrder: ["asc", "asc", "asc"],
                        groupSummary: [true, false, false],
                        groupSummaryPos: ['header', 'header', 'header'],
                        groupCollapse: false
                    }
                });

这里也是当前的截图。 enter image description here 我想要的不是显示&#39; RowNumber&#39;在分组中。有可能吗?

1 个答案:

答案 0 :(得分:1)

我建议你重新组织你的数据,从两个“RowNumber”和“WorkPlaceCodeName”中返回一个组合字段,例如组合字段中的示例“RowNumber”+ separator +“WorkPlaceCodeName”组,并使用groupingView中的formatDisplayField显示“WorkPlaceCodeName” ”