נגה פורסם 2014 ביולי 13 Share פורסם 2014 ביולי 13 אני רוצה ליצור עץ באמצעות jstree.את נתוני העץ אני מקבלת מDataBase.אבל, אני מקבלת את כל רשימת הצמתים לתוך תיקיה אחת.מה הבעיה?הקוד שלי:[/COLOR] <div id="treeViewDiv" ></div>[COLOR=#000000][/COLOR]function setResultData(data) { var dataArray = ""; for (i = 0; i < data.length; i++) { dataArray += "{'attributes: {'id': '" + data[i].ID + "' 'parent: '" + ((data[i].ParentID == null) ? "#" : data[i].ParentID) + " 'text:' '" + data[i].Text + "' },"; } if (dataArray != "") { initTree(dataArray); }}/////////////////////////////////////////////////////////////////////function initTree(dataArray) { $("#treeViewDiv").jstree({ "plugins": ["themes", "json_data", "ui"], "themes": { "theme": "classic", "dots": true, "icons": true }, "json_data": { //root elements "data": [dataArray], "ajax": { "type": 'POST', "data": { "action": 'getChildren' }, "url": function (node) { var nodeId = node.attr('id'); //id="A" return '/TreeTest.aspx/GetChildrenScript/' + nodeId; }, "success": function (new_data) { //where new_data = node children [{'data':'A1 node','attr':{'id':'A1'}}, {'data':'A2 node','attr':{'id':'A2'}}] return new_data; } } } });}[COLOR=#000000] קישור לתוכן שתף באתרים אחרים More sharing options...
Recommended Posts
ארכיון
דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.