jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Get data from selected rows only
Tagged: data selected records
This topic contains 8 replies, has 2 voices, and was last updated by guidov 11 years, 2 months ago.
-
Author
-
Hello,
I’m building an app and need to directly get the information from the selected records (Just like $(‘#jqxgrid’).jqxGrid(‘getrows’)).
I’d rather not loop through the records due to performance issues. Is there a way of achieving this?
Thanks in advance!
Sincerely,
Guido VisserHi Guido,
You can use “getrowdata” for that task. I prepared a small sample for you: http://jsfiddle.net/VuT7M/
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter,
I was aware of the “getrowdata”. But I want the data of all selected rows (multiple selected rows) without having to loop through all loaded records.
Just like “getrows”, but then with the selected rows only. Is that possible?
I hope to hear from you.
Sincerely,
Guido VisserHi Guido Visser,
You will have to loop through the selected rows. The “getselectedrowindexes” returns the indexes of the selected rows. Example: http://jsfiddle.net/jqwidgets/Vus5k/. Then you can use the “getrowdata” to get the data for each selected row.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hello Peter,
So I take it, this is not possible without looping? That would be a nice feature in you Grid.
Sincerely,
Guido VisserHi Guido Visser,
It is just a matter of few lines of code to get the selected rows. I don’t understand what is the problem. You have an Array of Indexes and you have another method which returns you Data from a passed Index.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter,
The problem is that I have a grid filled with a lot of records (1 million). Lets say I select 999.990 records; I’d have to loop through an incredible amount of rows to get the right row ID (Because my application moves rows from one grid to another) then loop through the records again to build an object with all the stored data. (Using ‘getrowdata’)
That’s why I’m wondering if it is possible to get the data directly, so I don’t have to loop through all of those records.
I hope this explains my situation a little better.
Sincerely,
Guido VisserHi Guido Visser,
Why do you have to loop through all records? I wrote you that there is a method called “getselectedrowindexes”. That method returns an Array of the selected row indexes. Your loop will use that Array. Hope you got the idea. If you wish you can use that approach. I would not be able to suggest you anything else.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter,
Yes indeed I can use that ‘selectedrowindexes’ approach, but if you have selected over 900 thousand records, it is an pretty big loop
Anyways, I think you answered my question by the fact that there is no other way.However is it possible in the future to get a functionality like; ‘getselectedrowdata’, which will return an array with all selected rows as an object? (like the ‘getrows’ method, but then with the selected row data)
Thanks for you time and help, I really appreciate it!
Sincerely,
Guido Visser -
AuthorPosts
You must be logged in to reply to this topic.