如何隐藏&禁用JqGrid GroupingView的“展开/折叠”按钮 [英] How to hide & disable Expand/Collapse button of JqGrid GroupingView
问题描述
我是JqGrid的新手,我正在使用JqGrid的GroupingView功能。它显示了每个组的折叠/展开按钮&点击它,它隐藏/显示其中的分组项目。我想隐藏&禁用折叠/展开按钮。请找到JsFiddle链接 - http://jsfiddle.net/564RP/25/
I am new to JqGrid, I am using GroupingView functionality of JqGrid. It shows Collapse/Expand button with each group & on click of it it hides/shows the grouped items inside it. I want to hide & disable the Collapse/Expand button. Please find the JsFiddle link - http://jsfiddle.net/564RP/25/
推荐答案
在您的代码中设置组文字如下: -
In your code you are setting the group text as below :-
groupText : ['<input name="chkHideTest" type="checkbox" class="groupHeader" isHidden="1" /> {0} '],
我在这里添加的两件事如下: -
1.为name =chkHideTest和
复选框元素命名2.一个名为'isHidden'的自定义属性然后将其值设置为1,您要为其创建通过检查来自数据库的数据,它隐藏为零。
实际上,展开按钮呈现如下代码: -
Two things i added here like below :-
1. Name to the checkbox element like name="chkHideTest" and
2. one custom attribute named 'isHidden' then set its value to 1 for which you want to make it hidden otherwise zero, by checking the data coming from database.
In actuall the expand button is rendered as below code :-
<table><tbody><tr><td style="padding-left:0px;" colspan="8"><span style="cursor:pointer;" class="ui-icon tree-wrap-ltr ui-icon-circlesmall-minus" onclick="jQuery('#grid').jqGrid('groupingToggle','gridghead_0_0');return false;"></span><input name="chkHideTest" type="checkbox" isHidden="1" class="groupHeader" name="grpHeader"> test </td></tr></tbody></table>
因此,组输入复选框的前一个元素是您要在那里禁用/隐藏的展开按钮。
所以我们需要为网格添加一个新设置,如下所示,它将在jqGrid加载完成后触发,如下所述: -
So the just before element for the group input checkbox is the expand button which you want to disable/invisible there.
So we need to add a new setting for the grid as below which will be fired just after the load completion of the jqGrid as mentioned below :-
loadComplete:function(){
.each(
( input [name ='chkHideTest']), function (i,obj){
var isHidden =
("input[name='chkHideTest']"), function(i, obj){ var isHidden=
这篇关于如何隐藏&禁用JqGrid GroupingView的“展开/折叠”按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!