Set rownumbers to false dynamically in jqgrid

2019-03-05 17:49发布

I like to show row numbers in my grid using the rownumbers property. But if only one row is returned, is there a way to set rownumbers to false dynamically. Why? Seeing a "1" in a column without a header is a little confusing at first glance. But if there are multiple rows then you quickly realize the purpose of that column.

标签: jqgrid
1条回答
霸刀☆藐视天下
2楼-- · 2019-03-05 18:14

You can try to hide the 'rn' columns, which hold the record numbers, if the number of records not large enough. Something like

loadComplete: function () {
    if ($(this).jqGrid('getGridParam', 'records') <= 1) { // this.p.records
        $(this).jqGrid('hideCol', 'rn');
    } else {
        // show previous hidden column
        $(this).jqGrid('showCol', 'rn');
    }
}
查看更多
登录 后发表回答