Stworzyłem drzewo z następującymi danymi. Po tym procesie wykonałem procedurę przeciągania między menu. W wyniku tego struktura menu została zmieniona. Chcę eksportować nowe dane Json, które mają taką samą strukturę z moimi pierwszymi danymi. Jak mogę pobrać dane z drzewa? Plese, pomóż mi.jstree uzyskać nowe dane json z drzewa
Próbowałem tego kodu, ale ten eksport bardzo skomplikowany json. Chcę jak mój pierwszy format danych.
var v = $('#data').jstree(true).get_json();
var mytext = JSON.stringify(v);
alert(mytext);
pierwszy stan menu:
ostatni stan menu:
// html demo
$('#html').jstree();
// inline data demo
$(function() {
var arrayCollection = [
{"id": "animal", "parent": "#", "text": "Animals"},
{"id": "device", "parent": "#", "text": "Devices"},
{"id": "dog", "parent": "animal", "text": "Dogs"},
{"id": "lion", "parent": "animal", "text": "Lions"},
{"id": "mobile", "parent": "device", "text": "Mobile Phones"},
{"id": "lappy", "parent": "device", "text": "Laptops"},
{"id": "daburman", "parent": "dog", "text": "Dabur Man", "icon": "/"},
{"id": "Dalmation", "parent": "dog", "text": "Dalmatian", "icon": "/"},
{"id": "african", "parent": "lion", "text": "African Lion", "icon": "/"},
{"id": "indian", "parent": "lion", "text": "Indian Lion", "icon": "/"},
{"id": "apple", "parent": "mobile", "text": "Apple IPhone 6", "icon": "/"},
{"id": "samsung", "parent": "mobile", "text": "Samsung Note II", "icon": "/"},
{"id": "lenevo", "parent": "lappy", "text": "Lenevo", "icon": "/"},
{"id": "hp", "parent": "lappy", "text": "HP", "icon": "/"}
];
$('#data').jstree({
'core' : {
'check_callback' : true,
'data' :arrayCollection ,
},
"plugins" : ["dnd","wholerow"]
});
});//function