jQWidgets Forums

jQuery UI Widgets Forums Grid Get data from selected rows only

This topic contains 8 replies, has 2 voices, and was last updated by  guidov 11 years, 2 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • Get data from selected rows only #53290

    guidov
    Participant

    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 Visser

    Get data from selected rows only #53291

    Peter Stoev
    Keymaster

    Hi Guido,

    You can use “getrowdata” for that task. I prepared a small sample for you: http://jsfiddle.net/VuT7M/

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Get data from selected rows only #53463

    guidov
    Participant

    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 Visser

    Get data from selected rows only #53464

    Peter Stoev
    Keymaster

    Hi 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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Get data from selected rows only #53478

    guidov
    Participant

    Hello Peter,

    So I take it, this is not possible without looping? That would be a nice feature in you Grid.

    Sincerely,
    Guido Visser

    Get data from selected rows only #53479

    Peter Stoev
    Keymaster

    Hi 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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Get data from selected rows only #53486

    guidov
    Participant

    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 Visser

    Get data from selected rows only #53487

    Peter Stoev
    Keymaster

    Hi 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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Get data from selected rows only #53492

    guidov
    Participant

    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

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.