Created
December 8, 2016 15:41
-
-
Save David-Mimnagh/802f9014c8fe2d419b3e53336d1f66fa 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 newChild = {}; | |
var list = []; | |
var treeNode = newTree.getRootNode(); | |
for (i = 0; i < treeData.length; i++) { | |
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