jqGrid multiselect “check all” in header: how to h

2019-01-09 15:14发布

I use jqGrid with the multiselect option set to true.

I'm looking for a way to hide or disable the first checkbox (the one in the row of the column names) so that users can't use the "check all/uncheck all" feature.

How to do it?

3条回答
做自己的国王
2楼-- · 2019-01-09 15:34

Find the div of checkbox and hide/overwrite its inner HTML.

查看更多
乱世女痞
3楼-- · 2019-01-09 15:49

If you have runat parameter

<trirand:JQGrid ID="grdTest" runat="server" 
"MultiSelect="true" MultiSelectMode="SelectOnRowClick">
    <Columns>
    <!-- cols -->
    </Columns>

     <ClientSideEvents GridInitialized="GrdInit" /><!-- add this -->
    </trirand:JQGrid>

On your page:

function getCont(control)
{
    if(control == "grdTest")
    { 
       return $("#<%= grdTest.ClientID %>"); 
    }
}

Then in your js file:

function GrdInit() 
{ 
    var myGrid = getCont("grdTest"); 
    myGrid.jqGrid('hideCol', 'cb'); 
}
查看更多
别忘想泡老子
4楼-- · 2019-01-09 15:52

The checkbox in the header has the id which is combined from the "cb_" prefix and the grid id. So you can hide the element with

var myGrid = $("#list");
$("#cb_"+myGrid[0].id).hide();
查看更多
登录 后发表回答