Jqgrid multiselect selected rows count?
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);
dr.linux
Hello World! I'm H.İbrahim Yılmaz (a.k.a. drlinux), co-author of Laravel Application Development Blueprints and Laravel Design Patterns and Best Practices books. I am a Python and PHP developer, Erlang newbie and e-commerce consultant. I've worked as a developer and software coordinator in over a dozen ventures including e-commerce, news and online media services. I have experience with as Google, YouTube, Facebook, Twitter, Grooveshark, and Paypal API. I'm learning French, Erlang and bass guitar. When I'm not working on client projects, I am often coding or playing my guitar. I live in a house full of Linux boxes in Turkey. Requests for my résumé are welcome. Please feel free to get in touch with me via my personal home page : http://drlinux.org
Updated on June 05, 2022Comments
-
dr.linux almost 2 years
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')
-
Kai over 12 yearsOk, then I misunderstood you. I thought you wanted to count the number of selected rows when using the multiselect option.
-
Oleg over 12 years@user275284: You are welcome! If the problem is solved you can mark the answer as "accepted".
-
Slimshadddyyy over 8 years@Oleg, wont this would also count empty field as well when multiselect is set to true
<input type="checkbox" class="cbox" id="cb_grid" role="checkbox">
making total ofselRowIds + 1
-
Oleg over 8 years@Slimshadddyyy: some time before you posted questions about problems with multiselect count, but if I remind me correctly, the problem existed only in combination with some old version of jQuery. I had no demo where I could reproduce the problem. See jsfiddle.net/OlegKi/aagxejj5/62 or jsfiddle.net/aagxejj5/61 in comments to the question. The demos displays correct value in all my tests. Which problem exactly you have now?
-
Slimshadddyyy over 8 years@Oleg the comment was out of curiosity, possibly my issue could be with older versions. Thanks again for your prompt response..:)