javascript 标题中的 jqGrid 多选“全选”:如何隐藏它?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6212571/
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
jqGrid multiselect "check all" in header: how to hide it?
提问by alessiodl
I use jqGridwith 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?
怎么做?
回答by Oleg
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
标题中的复选框具有由“cb_”前缀和网格 id 组合而成的 id。所以你可以隐藏元素
var myGrid = $("#list");
$("#cb_"+myGrid[0].id).hide();
回答by MLS
Find the div of checkbox and hide/overwrite its inner HTML.
找到复选框的 div 并隐藏/覆盖其内部 HTML。
回答by Mio
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');
}