So, I am just curious if it is possible to unselect currently clicked row in jQWidgets Grid.
I have tried the following code but seems like it's not working :
$("#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);
});
Here's how I initialized the grid :
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
}
});
alright I was trying to get this to work as well and here's what I came up with after a ton of searching:
$("#jqxGrid").on('rowclick', function (event) { var index = $("#jqxGrid").jqxGrid('getselectedrowindex'); var clickedIndex = event.args.rowindex; if (clickedIndex == index) { setTimeout(function () { $("#jqxGrid").jqxGrid('clearselection'); }, 10); } });
Also when you're creating the source set dataFields to datafields or else it won't work for some reason