本文介绍了在jqgrid中将行号动态设置为false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢使用rownumbers属性在网格中显示行号.但是,如果仅返回一行,是否有办法动态地将rownumbers设置为false.为什么?乍一看,在没有标题的列中看到"1"会有些混乱.但是,如果有多行,那么您很快就会意识到该列的用途.

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.

推荐答案

如果记录数不够大,您可以尝试隐藏'rn'列,该列保存记录号.像

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');
    }
}

这篇关于在jqgrid中将行号动态设置为false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 23:33