我需要隐藏jQgrid上的所有复选框,并在阅读这两篇文章后:
- 从 jqgrid 中删除标题复选框
- jqGrid在标题中多选"全选":如何隐藏它?
这是我所做的:
// this only hides the first checkbox on the header
$('#gbox_grid_notification_queue').find('input[type="checkbox"]').hide();
// this does not hide anything at all
$('#gbox_grid_notification_queue').find('td input[type="checkbox"]').hide();
// this does not hide anything, same as previous one
var grid_notification_queue = $("#grid_notification_queue");
$("#cb_" + grid_notification_queue.id).hide();
我在这里缺少什么?
如果你使用免费的jqGrid分叉,那么解决方案将非常简单。你只需要添加
multiselectPosition: "none"
选项以防止创建复选框。它还提高了多选功能的性能。我提醒一下,在这里您可以找到与选择相关的免费 jqGrid 的不同选项。multiselectPosition
的值可以是"left"
、"right"
或"none"
。
您可以使用此代码
$("input[type=checkbox]").each(function() {
$(this).hide();
});
试试这个:
$('#gbox_grid_notification_queue').find('input[type="checkbox"]').each(function(){
$(this).hide();
});