Created
December 8, 2016 15:41
-
-
Save David-Mimnagh/4968229441c4c3cb3af2fa9c61faca3d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (treeData == null) { | |
var treeData = Ext.Ajax.request({ | |
method: 'GET', | |
url: '/Dashboard/GetNavigationData', | |
success: function (response) { | |
treeData = Ext.util.JSON.decode(response.responseText).results; | |
var list = []; | |
var treeNode = newTree.getRootNode(); | |
for (i = 0; i < treeData.length; i++) { | |
var newChild = {}; | |
newChild.Id = treeData[i].Id; | |
newChild.text = treeData[i].text; | |
newChild.iconCls = treeData[i].iconCls; | |
newChild.leaf = treeData[i].leaf; | |
newChild.children = {}; | |
if (i == treeData.length) | |
newChild.isLast = true; | |
else | |
newChild.isLast = false; | |
if (i == 0) | |
newChild.isFirst = true; | |
else | |
newChild.isFirst = false; | |
if (treeData[i].children.length > 0) { | |
for (j = 0; j < treeData[i].children.length; j++) { | |
newChild.children.text = treeData[i].children[j].text; | |
newChild.path = treeData[i].children[0].path; | |
newChild.children.path = treeData[i].children[j].path; | |
newChild.children.Id = treeData[i].children[j].Id; | |
newChild.children.iconCls = treeData[i].children[j].iconCls; | |
newChild.children.parentId = treeData[i].children[j].ParentId; | |
newChild.children.leaf = treeData[i].children[j].leaf; | |
} | |
} | |
treeNode.appendChild(newChild); | |
Ext.getCmp('Dashtree2').getView().refresh(); | |
debugger; | |
} | |
navigationStore.loadData(treeData); | |
navigationStore.sync(); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment