formating json to populate a treeview

3 posts, 1 answers
  1. Paul
    Paul avatar
    28 posts
    Member since:
    May 2016

    Posted 24 Aug Link to this post

    Hi I have an ajax call which returns a json string which consists of -

    "{"d":[{"path":"/","e_type":"d ","text":"/"},

    {"path":"//SQL","e_type":"d ","text":"//SQL"},

    {"path":"//SQL/SourceClips","e_type":"d ","text":"//SQL/SourceClips"},

    {"path":"//SQL/SourceClips/kjpDNxHD145_MC403.mov","e_type":"f ","text":"//SQL/SourceClips/kjpDNxHD145_MC403.mov"}]}"

     

    I am trying to format this so there are 3 folders and one file inside the 3rd folder in the tree view. I want to use a loop so i can reuse this for any data I return.

    Currently that is fine as far as printing each item on separate lines but i am trying to nest the last item into the third item.

     

    Any help would be very appreciated.

         

     

  2. Answer
    Daniel
    Admin
    Daniel avatar
    2118 posts

    Posted 26 Aug Link to this post

    Hello,

    Assuming that the files should be nested in the directory with the longest matching path, you can use approach similar to the one demonstrated in this example to create the data.

    Regards,
    Daniel
    Telerik by Progress
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
  3. Kendo UI is VS 2017 Ready
  4. Paul
    Paul avatar
    28 posts
    Member since:
    May 2016

    Posted 26 Aug in reply to Daniel Link to this post

    THis is perfect thank you.
Back to Top