下拉树的问题

[size=small][b]http://www.iteye.com/topic/212842

我照着这个做了一个下拉树,选完一个节点之后,在去填别的选项,刚选择的节点就清空了,这个怎么回事啊?

附件是图片 。[/b][/size]
[b]问题补充:[/b]
还是不行啊,我重新弄了一遍还是不行。不知道怎么回事
[b]问题补充:[/b]
我刚刚完全拷贝它的例子做了一次,还是这样。
使用的全是他提供的组件也不行 我的是Ext3.0版本的
[b]问题补充:[/b]
http://hi.baidu.com/tzjobs/blog/item/0faad4f542c899e67609d71d.html

试了。还是不行、 我上午用的是这个人的下拉树,但是传值的时候传的总是node.text

这个是我用他的,不知道我有没有改过,我是在3.0环境下可以正常使用

[code="js"]
Ext.ux.ComboBoxTree = function() {
this.treeId = Ext.id() + '-tree';
this.maxHeight = arguments[0].maxHeight || arguments[0].height || this.maxHeight;
this.maxWidth = arguments[0].maxWidth || arguments[0].width || this.maxWidth;
this.tpl = new Ext.Template('

');
this.store = new Ext.data.SimpleStore({
fields : [],
data : [[]]
});
this.selectedClass = '';
this.mode = 'local';
this.triggerAction = 'all';
this.onSelect = Ext.emptyFn;
this.editable = false;

// all:所有结点都可选中
// exceptRoot:除根结点,其它结点都可选
// folder:只有目录(非叶子和非根结点)可选
// leaf:只有叶子结点可选
this.selectNodeModel = arguments[0].selectNodeModel || 'exceptRoot';
Ext.ux.ComboBoxTree.superclass.constructor.apply(this, arguments);

}

Ext.extend(Ext.ux.ComboBoxTree, Ext.form.ComboBox, {
expand : function() {
Ext.ux.ComboBoxTree.superclass.expand.call(this);
if (!this.tree.rendered) {
this.tree.height = this.maxHeight;
this.tree.width = this.maxWidth;
this.tree.border = false;
this.tree.autoScroll = true;
if (this.tree.xtype) {
this.tree = Ext.ComponentMgr.create(this.tree, this.tree.xtype);
}
this.tree.render(this.treeId);
var combox = this;
this.tree.on('click', function(node) {
var isRoot = (node == combox.tree.getRootNode());
var selModel = combox.selectNodeModel;
var isLeaf = node.isLeaf();
if (isRoot && selModel != 'all') {
return;
} else if (selModel == 'folder' && isLeaf) {
return;
} else if (selModel == 'leaf' && !isLeaf) {
return;
}
combox.setValue(node);
combox.collapse();
});
var root = this.tree.getRootNode();
if (!root.isLoaded()){
root.reload();
}
}
},

setValue : function(node) {
    var text = node.text;
    this.lastSelectionText = text;
    if (this.hiddenField) {
        this.hiddenField.value = node.id;
    }
    Ext.form.ComboBox.superclass.setValue.call(this, text);
    this.value = node.id;
},

getValue : function() {
    return typeof this.value != 'undefined' ? this.value : '';
}

});
Ext.reg('combotree', Ext.ux.ComboBoxTree);
[/code]

我是这样使用的,不知道和你的有什么区别

[code="js"]
{
fieldLabel : '模块',
xtype : 'combotree',
name : 'module',
hiddenName : 'question.module',
allowBlank : false,
blankText : '必须选择模块!',
selectNodeModel : 'leaf',
emptyText : '请选择...',
tree : {
xtype : 'treepanel',
rootVisible : false,
loader : new Ext.tree.TreeLoader({
preloadChildren : true,
clearOnLoad : false
}),
root : new Ext.tree.AsyncTreeNode({
text : '根结点',
expanded : true,
children : Ext.help.treeData
})
}
}
[/code]

你用3.0还是?

我在3.0环境下使用过他的组建,没有任何问题,请仔细检查和对比他提供的示例,从你描述的问题来看,应该是一个低级错误.应该是选中的value的类型不符合下拉的要求.数据当时是能够显示在文本框里面.当你离开的时候就消失了

你在他提供的示例里面增加一个其他的组建放到判断,然后选择他树里面的选项后离开到另外一个组件看看是否有问题.

[quote]你在他提供的示例里面增加一个其他的组建放到判断,然后选择他树里面的选项后离开到另外一个组件看看是否有问题.[/quote]

你按照我说的做了吗?