Ext.Window 多次传入值如何更新
//keyValue, textValue 点按钮传入的id ,每次有可能不一样。设置keyValue, textValue 的值后再次传入新的id, //deptTree.on 中还是第一次传入的id。如何在不重复掉后台的情况下传入不同的keyValue, textValue,并设置值。
Ext.onReady(function(){
var deptWin,deptWin2;
showKmWin = function(keyValue, textValue){alert(keyValue);
if(!deptWin){
var deptTree = new Ext.tree.TreePanel({
id:'dept-tree',
useArrows: true,
border:false,
bodyStyle: 'padding-top:5px;padding-left:5px; margin-top:0px;',
loader: new Ext.tree.TreeLoader({
dataUrl:'CommonsModuleDeptTree_queryZwkmShowTreeList.action'
}),
rootVisible:false,
lines:false,
autoScroll:true,
root: new Ext.tree.AsyncTreeNode({text: '根结点', id: 'root'})
});alert(keyValue);
deptTree.on('click', function(node){
var deptText;
var parentNode = node.parentNode;
if(parentNode.id == 'root'){
if(node.id == 'all'){
document.getElementById(textValue).value='';
document.getElementById(keyValue).value='';
}else{
document.getElementById(textValue).value=node.text;
document.getElementById(keyValue).value=node.id;
}
}else{
alert(keyValue);
deptText = parentNode.text + ' → ' + node.text;
document.getElementById(textValue).value=deptText;
document.getElementById(keyValue).value=node.id;
}
Ext.getCmp('dept-Win').hide();
});
deptWin = new Ext.Window({
id: 'dept-Win',
title: '选择会计科目',
width: 200,
height: 400,
closeAction:'hide',
minWidth: 250,
minHeight: 350,
layout: 'fit',
//resizable: false,
shadow:false,
items: deptTree
});
}
deptWin.show();
}
});