-1

I want to generate a treeview with a data that I get through a procedure

enter image description here

This would become my json that generates me.

enter image description here

This way I bring my data, so I saw in example use a .json file that is not my case.

I would like help with it. First of all, Thanks!

  • Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the [How to Ask](https://stackoverflow.com/help/how-to-ask) page for help clarifying this question. – herrbischoff Jul 05 '17 at 16:48

1 Answers1

0

It's so easy, just think about another way. You are sending data from the server as a JSON response, instead of that use that send a String/Variable and use that in your view directly. You have to use your Result array(in controller to generate the sring). For example:-

Consider $Items-->Is your result array.

foreach($items as item)
{    
   $dataSource='[
                    { text: "Furniture", expanded: true, items: [
                        { text: "Tables & Chairs" },
                        { text: "Sofas" },
                        { text: "Occasional Furniture" }
                    ] },
                    { text: "Decor", items: [
                        { text: "Bed Linen" },
                        { text: "Curtains & Blinds" },
                        { text: "Carpets" }
                    ] }
                ]';
}

Better you use a recursive function to get the string and save that string to data source variable.

If still this is not clear to you then let me know, I will clearly write some block of code for you.

bikash.bilz
  • 821
  • 1
  • 13
  • 33