Javascript 是否可以从 jqGrid 标题中删除展开/折叠按钮?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2015254/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-22 22:24:27  来源:igfitidea点击:

Is it possible to remove the expand/collapse button from the jqGrid header?

javascriptjqueryjqgrid

提问by btelles

I'm using the jqGrid available at http://www.trirand.com/jqgrid/jqgrid.htmland I can't find a way to disable its expand/collapse button on the top right of the header. Anyone know if there's an option to do that?

我正在使用http://www.trirand.com/jqgrid/jqgrid.html 上提供的 jqGrid ,但我找不到禁用标题右上角的展开/折叠按钮的方法。有谁知道是否有办法做到这一点?

I'd like to remove the thing circled in red: alt text

我想删除红色圈出的东西: 替代文字

回答by Justin Ethier

Yes, there is an option for this: hidegrid: false

是的,有一个选项: hidegrid: false



来自 jqGrid documentation wiki for Options选项的 jqGrid 文档维基

hidegrid

boolean

Enables or disables the show/hide grid button, which appears on the right side of the Caption layer. Takes effect only if the caption property is not an empty string.

隐藏网格

布尔值

启用或禁用显示/隐藏网格按钮,它出现在 Caption 层的右侧。仅当 caption 属性不是空字符串时才生效。

回答by Pankaj Pravin

Use this code to colllapse all jqgrid on the page

使用此代码折叠页面上的所有 jqgrid

elements = $('div.ui-jqgrid-bdiv');
elements.each(function() { $(this).css("display", "none"); });
elements = $('div.ui-jqgrid-hdiv');
elements.each(function() { $(this).css("display", "none"); });
$('#JQGrid_pager').hide();
$('#rs_mJQGrid').hide();

回答by PUBG

If you want to disable the main grids toggle button then you can set

如果要禁用主网格切换按钮,则可以设置

hidegrid: false

If you are trying to disable or hide the subgrids expand and collapse button then use this on loadcomplete

如果您尝试禁用或隐藏子网格展开和折叠按钮,请在 loadcomplete 上使用它

jQuery("#GridTeableID").jqGrid('hideCol', "subgrid");