Domanda

Sto cercando di caricare Dynatree usando un oggetto JSON tramite Ajax. Non ho il controllo sui nomi e sui valori JSON all'interno dell'oggetto. Saranno nel formato seguente. Non sono stato in grado di far caricare l'albero. Esiste un formato specifico in cui JSON deve essere, per caricare correttamente?

Ecco il json

{
   "root":true,
   "topNode": {
      "containerId":"1",
      "children":[
         {
            "containerId":"2",
            "children":[

            ],
            "root":false
         },
         {
            "containerId":"3",
            "children":[
               {
                  "containerId":"4",
                  "children":[

                  ],
                  "root":false
               }
            ],
            "root":false
         },
         {
            "containerId":"5",
            "children":[
               {
                  "containerId":"6",
                  "children":[

                  ],
                  "root":false
               },
               {
                  "containerId":"7",
                  "children":[

                  ],
                  "root":false
               }
            ],
            "root":false
         } 
      ],
      "root":true
   }
}

Ecco il JavaScript:

      $(function(){
        $("#treeView").dynatree({
              initAjax: {
                  url: "/myURL",
                  },
        });
      });

Nessuna soluzione corretta

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top