Results 1 to 4 of 4

Thread: Serialize tree

  1. #1
    Sencha Premium User
    Join Date
    Jun 2012
    Posts
    212
    Answers
    13
    Vote Rating
    3
      0  

    Default Answered: Serialize tree

    What is the recommended way to serialize a tree respectively treestore into json, so one can save the whole tree at once in localstorage, for example?

    I guess the resulting json should look like this to be able to re-use it directly:
    Code:
    root: {text: 'root', children: [
        {text: 'leaf1'},
        {text: 'leaf2', children: [
            {},
            {}, ...
        ]}
    ]
    This might seem obvious, but I can't find the answer from the docs or previous posts. Isn't there anything built-in? I have created my own iteration function, but I can't imagine such a common task has to be re-built every time someone needs that...?

    Thanks!

  2. Hopefully, tree nodes will get the serialize method in 4.2

    I have added it, just needs review and QA

  3. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,062
    Answers
    3976
    Vote Rating
    1390
      0  

    Default

    You can use the cascade method to work through the tree.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  4. #3
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Redwood City
    Posts
    30,862
    Answers
    39
    Vote Rating
    85
      0  

    Default

    Hopefully, tree nodes will get the serialize method in 4.2

    I have added it, just needs review and QA
    Longtime Sencha engineer. Now surplus to requirements apparently...

  5. #4
    Sencha User slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,165
    Answers
    505
    Vote Rating
    253
      0  

    Default

    Nice, Animal!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •