我正在开发一个简单的网格表单,它有一个组合框和作为代理的数据源(如http://goo.gl/2fxP8)。combobox加载正常,但当我尝试选择其中一个列表项时,网格表单关闭,但combobox没有关闭。有人能帮我吗?
我还计划扩展combobox onselect函数,这样一旦选择了列表项,其他字段就会被动态加载。
searchField = new Ext.form.ComboBox({
store: ds,
name : 'search',
id:'search',
fieldLabel : 'Search',
displayField:'title',
typeAhead: false,
loadingText: 'Searching...',
pageSize:10,
minChars:2,
triggerAction: 'all',
width: 200,
tpl: resTpl,
itemSelector: 'div.search-item',
onSelect: function(record){
/* Set Values to other fields here */
}
}),保存代码为:
Ext.Ajax.request
({
url:"some url",
scope:this,
params:
{
},
success: function(objServerResponse)
{
eval("var resultSet = " +objServerResponse.responseText);
if(resultSet.isOk)
{
this.collapse();
}
else
{
}
}
});发布于 2011-08-11 10:30:23
我认为问题是你覆盖了onSelect函数..
看看here (尝试找到onSelect),onSelect方法是私有的……
正如您所看到的,默认情况下,在onSelect内部有要调用的collapse函数。所以,如果你使用onSelect..默认情况下,您的组合不会崩溃。
您必须手动执行此操作。就像基兰说的..。
我的问题是,为什么要重写onSelect函数?
如果您需要在选择组合时执行某些操作,为什么不将其设置为listeners?
尝试更改您的代码:
onSelect: function(record){
/* Set Values to other fields here */
}使用这一条:
listeners : {
"select" : function(combo,data,idx){
console.info(data);
}
}https://stackoverflow.com/questions/7007301
复制相似问题