Heim > Artikel > Web-Frontend > 动态刷新 dorado树的js代码_javascript技巧
function flushDataTree()
{
dataset_mainMenuTemp.setShowLoadingTip(true);
var rootNode = tree_Menu.getFirstRootNode();
tree_Menu.setCurrentNode(rootNode);
tree_Menu.expandNode(rootNode);
dataset_mainMenu.clearData();
dataset_mainMenuTemp.flushData();
dataset_mainMenuTemp.flushDataAsync(function(succeed)
{
if (!succeed) return;
dataset_mainMenuTemp.disableControls();
try {
dataset_mainMenuTemp.moveFirst();
while (!dataset_mainMenuTemp.isLast())
{
var record=dataset_mainMenuTemp.getCurrent();
var node = new RecordTreeNode(record, rootNode.getTreeLevel().getTreeLevel("level_menu"));
rootNode.addNode(node);
dataset_mainMenuTemp.moveNext();
}
}catch(e)
{
alert(e.message);
}
finally {
dataset_mainMenuTemp.enableControls();
flushThirdLevelNode();
}
});
}
function flushThirdLevelNode(){
try {
dataset_myMailBox.parameters().setValue("myBoxCoding","box03");
dataset_myMailBox.flushData();
//将当前节点展开
var currentNode=getCurrentNodeNum(3);
tree_Menu.expandNode(currentNode);
//向dataset中新增一条节点数据
dataset_myMailBox.disableControls();
dataset_myMailBox.moveFirst();
while (!dataset_myMailBox.isLast())
{
record=dataset_myMailBox.getCurrent();
var node = new RecordTreeNode(record, currentNode.getTreeLevel().getTreeLevel("level_myMailBox"));
//新增节点
currentNode.addNode(node);
dataset_myMailBox.moveNext();
}
}catch(e)
{
alert(e.message);
} finally {
dataset_myMailBox.enableControls();
}
}