Reputation: 75147
I have a disabled button at my page. When a row selected at my grid I want to enable it. If any of rows is not selected it should be return to disable too. ,
How can I detect when a row is selected and non of rows is selected at jqgrid?
Upvotes: 0
Views: 3970
Reputation: 221997
If you use multiselect: true
option you should do the following
onSelectRow: function (id) {
var selRows = $(this).jqGrid('getGridParam','selarrrow');
if (selRows.length === 0) {
alert ("no rows are selected now");
// you can disable the button
} else {
alert ("a row is selected now");
// you can disable the button
}
}
additionally you should include in the loadComplete
the code which disable of the button because at the beginning, after changing the sort order or after filtering (if you use it) the rows will be not selected.
Upvotes: 2