Jqgrid multiselect selected rows count?

dr.linux picture dr.linux · Aug 26, 2011 · Viewed 10.5k times · Source

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')

Answer

Oleg picture Oleg · Aug 26, 2011

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);