[英]multiselect behavior in single select jqGrid
I have a page with a jqGrid in it. 我有一个带有jqGrid的页面。 Is has to be
multiselect:false
because I have to allow only one row to be selected, but I also need to select multiple rows (ie I want to have many rows marked but only one active). is必须是
multiselect:false
因为我必须只允许选择一行,但是我还需要选择多行(即,我想标记很多行,但只有一行处于活动状态)。 So I've created a grid whith multiselect:false and a checkbox row with formatter: 'checkbox'
I've also created a master checkbox in the collumn header (the 'name' of the collumn in the colNames is <input id="cbSelectAll" type="checkbox">
) 因此,我创建了一个网格,其中multiselect:false和一个带有
formatter: 'checkbox'
符的复选框行formatter: 'checkbox'
我还在collumn标头中创建了一个主复选框 (colNames中collumn的“名称”为<input id="cbSelectAll" type="checkbox">
)
To change all the rows at once when the header is clicked I've created the function: 要在单击标题时立即更改所有行,我创建了函数:
$('#cbSelectAll').click(function (e) {
var valor = $(this).is(':checked');
$.each($('#grid input[type="checkbox"]'), function (idx, elm) {
var id = $(elm).closest('tr').attr('id');
var cb = $('#' + id + ' td').children().first();
$(cb).attr('checked', valor);
selectedRows[id] = valor;
});
/* other non relevant code */
});
Now that's my problem. 这就是我的问题。 This function works nicelly when I try to unselect the checkbox's but when i try to select then it only works in the first time.
当我尝试取消选择复选框时,此功能很好地起作用,但是当我尝试选择时,它仅在第一次使用时有效。 On the subsequent clicks the checked attribute is changed but the box is not visually changed.
在随后的单击中,选中的属性会更改,但该框在外观上不会更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.