im building an gallery app and i need it to be in tree format , im using the jstree extension to build it , and i need the json to be in this format:
$(function () {
$("#demo1").jstree({
"json_data" : {
"data" : [
{
"data" : "A node",
"metadata" : { id : 23 },
"children" : [ "Child 1", "A Child 2" ]
},
{
"attr" : { "id" : "li.node.id1" },
"data" : {
"title" : "Long format demo",
"attr" : { "href" : "#" }
}
}
]
},
"plugins" : [ "themes", "json_data", "ui" ]
}).bind("select_node.jstree", function (e, data) { alert(data.rslt.obj.data("id")); });
});
and im using this database:
categorys: id name id_father
products: id name price category_id
please help me guys , >_< , im using an MVC structure in my project and its possible to do things like foreach(modelinstance as model) ...
help i realy need it and i have no idea how to build it