1. 在选择某个树节点后,执行了一些增删改后,在刷新树后,应该还要选中刚才操作的节点。
第一次默认选中第一个树节点,
节点被删除后也选择第一个节点,
增加,修改后,还要选中刚才操作的节点
?
treeBZGC.on("load", function(nd)
?? {
?????
????? if(me.getRootNode()==nd){
???????? var firstNode = treeBZGC.getFirstChild();//初始化第一个节点
???????? if(!currentNodePath)//首次进来,默认选中第一个节点
???????? {
??????????? var firstPath = firstNode.getPath();
???????? ?? me.selectPath(firstPath,null,function(bSuccess,bNode)
??????????? {
?????????????? bNode.fireEvent("click",bNode);
??????????? });
???????? }
???????? else
???????? {
???????? ? me.selectPath(currentNodePath,null,function(bSuccess,bNode){
?????????????? if(bSuccess)//选中节点了,执行click
?????????????? {
????????????????? bNode.fireEvent("click",bNode);
?????????????? }
?????????????? else // 否则选中第一个
?????????????? {
????????????????? var firstPath = firstNode.getPath();
?????????????? ?? me.selectPath(firstPath,null,function(bSuccess,bNode)
????????????????? {
????????????????? ?? bNode.fireEvent("click",bNode);
????????????????? });
?????????????? }
??????????? });
???????? }
????? }
});