[{"id":"17","text":"BBB-Currency Master","parent":"#"},{"id":"1","text":"AED-United Arab Emirates Dirham","parent":"17"},{"id":"2","text":"AUD-Australia Dollar","parent":"17"},{"id":"3","text":"CHF-Switzerland Franc","parent":"17"},{"id":"4","text":"GBP-United Kingdom Pound","parent":"17"},{"id":"5","text":"INR-India Rupe","parent":"17"},{"id":"16","text":"AAA-Chart Of Accounts","parent":"#"},{"id":"6","text":"A06-Sales Invoice","parent":"16"},{"id":"7","text":"A07-Receipts","parent":"16"},{"id":"8","text":"A08-Payments","parent":"16"},{"id":"9","text":"A09-Cash Sales","parent":"16"},{"id":"10","text":"A10-Opening Balances","parent":"16"},{"id":"11","text":"A11-Sales Return","parent":"16"},{"id":"12","text":"A12-Payroll Postings","parent":"16"},{"id":"13","text":"A13-Fixed Assets","parent":"16"},{"id":"14","text":"A14-Forex Journal Voucher","parent":"16"},{"id":"15","text":"A15-Purchase Return","parent":"16"}]
Thanks in advance....
var ref = $('#container').jstree(true);
var SNo=UniqueNo();
var Code=$('#AcCode').val().trim();
var Desc=$('#AcDesc').val().trim();
sel = ref.get_selected();
var node = {id:SNo,text:Code+" "+Desc};
$('#container').jstree('create_node', sel, node, 'last');
});
"types" : {
"#" : {
"max_children" : -1,
"max_depth" : -1,
"valid_children" : ["root"]
},
"root" : {
"icon" : "images/folder.png",
"valid_children" : ["default"]
},
"default" : {
"valid_children" : ["default","file"]
},
"file" : {
"icon" : "images/file.png",
"valid_children" : []
}
},
$('#container').jstree().create_node(sel, node, 'last');
[{"type":"root","id":"17","text":"Currency Master","parent":"#"},{"type":"file","id":"1","text":"AED-United Arab Emirates Dirham","parent":"17"},{"type":"file","id":"2","text":"AUD-Australia Dollar","parent":"17"},{"type":"file","id":"3","text":"CHF-Switzerland Franc","parent":"17"},{"type":"file","id":"4","text":"GBP-United Kingdom Pound","parent":"17"},{"type":"file","id":"5","text":"INR-India Rupe","parent":"17"},{"type":"root","id":"16","text":"Chart Of Accounts","parent":"#"},{"type":"file","id":"6","text":"A06-Sales Invoice","parent":"16"},{"type":"file","id":"7","text":"A07-Receipts","parent":"16"},{"type":"file","id":"8","text":"A08-Payments","parent":"16"},{"type":"file","id":"9","text":"A09-Cash Sales","parent":"16"},{"type":"file","id":"10","text":"A10-Opening Balances","parent":"16"},{"type":"file","id":"11","text":"A11-Sales Return","parent":"16"},{"type":"file","id":"12","text":"A12-Payroll Postings","parent":"16"},{"type":"file","id":"13","text":"A13-Fixed Assets","parent":"16"},{"type":"file","id":"14","text":"A14-Forex Journal Voucher","parent":"16"},{"type":"file","id":"15","text":"A15-Purchase Return","parent":"16"}]
"icon" : "images/folder.png",
"valid_children" : ["default"]
}
Now if you try to put a File Type node inside a Root type node (ID 16 and 17) it won't work because you are telling the root type node to ONLY accept Default type nodes as children.
"icon" : "images/folder.png",
"valid_children" : ["default", "file"]
}
Let me know if this fix the problem.