I'm using Jqgrid by multiselect option. I want to get selected rows count on Jqgrid .
I tried that but no luck...
var count = jQuery('#grid').length;
if (count > 5)
alert('The Selected Rows More Than 5')
I'm using Jqgrid by multiselect option. I want to get selected rows count on Jqgrid .
I tried that but no luck...
var count = jQuery('#grid').length;
if (count > 5)
alert('The Selected Rows More Than 5')
You should just get the length of the array selarrrow:
var selRowIds = jQuery('#grid').jqGrid('getGridParam', 'selarrrow');
alert ('The number of selected rows: ' + selRowIds.length);
This works for me: Place a link anywhere you want
<a href="/" id="displayNoSelectedRows">Click me!</a>
and now simply register the callback function
$("#displayNoSelectedRows").click(function() {
var no = $("input[id^='jqg_gridid_']:checked").length;
alert(no);
return false;
});
for this link, where gridid
is the table's id. With the knowledge of how the checkboxes are named (or better the way the ids are assigned) this is a possible way to get the number of selected checkboxes.