[英]jqGrid multiselect “check all” in header: how to hide it?
I use jqGrid with the multiselect option set to true.我使用jqGrid并将多选选项设置为 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?怎么做?
The checkbox in the header has the id which is combined from the "cb_" prefix and the grid id. header 中的复选框具有由“cb_”前缀和网格 ID 组合而成的 ID。 So you can hide the element with
所以你可以隐藏元素
var myGrid = $("#list");
$("#cb_"+myGrid[0].id).hide();
Find the div of checkbox and hide/overwrite its inner HTML.找到复选框的 div 并隐藏/覆盖其内部 HTML。
If you have runat parameter如果你有 runat 参数
<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:然后在你的js文件中:
function GrdInit()
{
var myGrid = getCont("grdTest");
myGrid.jqGrid('hideCol', 'cb');
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.