所以,我只是好奇是否可以取消选择 jQWidgets Grid 中当前单击的行。
我已经尝试了以下代码,但似乎它不起作用:
$("#jqxGrid").on("rowclick", function (event) {
var selectedRowIdx = event.args.rowindex;
// this part doesn't work
$("#jqxGrid").jqxGrid('unselectrow', selectedRowIdx);
// this part doesn't work as well
$("#jqxGrid").jqxGrid('clearselection');
$("#jqxGrid").jqxGrid('selectrow', 0);
});
这是我初始化网格的方式:
var columns = { .. some init values here };
$('#jqxGrid').jqxGrid({
autoheight: true
, width: '100%'
, pageable: true
, altrows: true
, source: {}
, columnsresize: false
, columnsheight: 25
, autoheight: true
, autorowheight: true
, sortable: true
, editable: true
, altrows: true
, selectionmode: 'singlerow'
, pagermode: "simple"
, columns: columns
, ready : function() {
columnSelection.initialize('#jqxGrid',0,"10",columns);
}
, cellhover: function (element, pageX, pageY){
// hover churvabels here
}
});