jQWidgets Forums

jQuery UI Widgets Forums TreeGrid How to get *all* rows in treeGrid ?

This topic contains 7 replies, has 2 voices, and was last updated by  Peter Stoev 10 years, 10 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
  • How to get *all* rows in treeGrid ? #53787

    Marc
    Participant

    Hi,

    var allRows = $("#treeGrid").jqxTreeGrid('getRows');

    will return only level 1 rows. Is there a way to get in a table all rows, regardless of their level in the tree ?

    Thanks and best regards.

    How to get *all* rows in treeGrid ? #53791

    Peter Stoev
    Keymaster

    Hi Marc,

    Actually, your statement is incorrect. “getRows” returns All rows. jqxTreeGrid is a Hierarchical Grid and the returned Data is Hierarchical Array as well. Each record may have sub records stored in its own “records” Array.

    Best Regards,
    Peter Stoev

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

    How to get *all* rows in treeGrid ? #53797

    Marc
    Participant

    tl;dr : makes sense. Won’t make it easy though to get all say level 5 children of a level 4 parent. No way to get a flat list ?

    Hi Pete,

    Thank you for your quick answer.

    Your reply makes sense. And I agree that if I had taken the time to look at the records array field in my browser’s debugger, I would have guessed the hierarchical ordering of the rows.

    Shall I understand from your reply that there is no way to get an unordered (flat) list of all rows ? It would make it easier to parse for a given parent.

    To make myself clearer, assuming I’m on a level 4 row, and want to get all (level 5) children, and unless I’m missing something, I understand I would have to write the following code :
    – From level 4, store somewhere the sequence of all 3 levels parent rows
    – Get the hierarchically ordered set of rows with ‘getRows’
    – Walk down step by step the returned array, using the stored sequence of parents, to find back the level 4.
    – From there, eventually, get the children.
    Am I missing something ?

    And please :
    – if your answer deals with flat list, please feel free to post it here.
    – if your answer deals with children, please feel free to reply to my next post.

    As you see, the questions are distinct, even if the replies may collapse. And please remember, before shooting me down in your posts, that I don’t know the reply when I ask the question. Otherwise I wouldn’t ask 🙂

    Best regards.


    Peter Stoev
    Keymaster

    Hi Marc,

    Actually you should have looked at the Documentation, not at the Debugger for “records”, because “records” as a member of getRows method results is documented: jquery-treegrid-api.htm. Yes, if you want to get Flat list, you will have to Traverse the getRows array with some custom logic.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    Marc
    Participant

    Come on Pete, are you really suggesting that, before posting, I should read the dozens of methods, events, properties, of this single widget (not to speak about the others) ?

    Not really my way of learning, sorry…

    Thanks for the answer, anyway…


    Peter Stoev
    Keymaster

    Hi Marc,

    It’s not necessary to read dozens of methods, but if you use a method called “getRows” it would be good to read what it does and what it returns, because it is already documented. That’s the reason we write that documentation.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    Marc
    Participant

    Cool Pete, cool…

    Your posts are *very* unfriendly, but I’l be indulgent because :

    – Answering all the forum’s questions as you seem to be doing it must be sometime a true bore and…
    – … I need the help of guys like you anyway to get up to speed with jqWidgets 🙂

    Just kidding…


    Peter Stoev
    Keymaster

    Hi Marc,

    Thank you for you post. I am very sorry that you think that pointing you to the right direction is “unfriendly”.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.