0

我正在研究一个简单的网格表单,它有一个组合框和数据源作为代理(如http://goo.gl/2fxP8)。组合框正确加载,但是当我尝试选择其中一个列表项时,gridform 会关闭并且组合框不会关闭。谁能帮我吗 ?

我还计划扩展组合框 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
                                        {


                                        }

                                    }
                                    });
4

1 回答 1

0

我认为问题是你覆盖了这个onSelect函数..
看看这里(尝试找到onSelect),onSelect方法是私有的......
正如你所看到的,里面onSelectcollapse默认调用的函数..所以,如果你被覆盖了onSelect。 .默认情况下,您的组合永远不会崩溃..
您必须手动进行..就像基兰所说的那样...

我的问题是,您为什么要覆盖该onSelect功能??
如果您需要做某事选择组合时,为什么不将其设置为侦听器?

尝试更改您的代码:

 onSelect: function(record){ 
 /* Set Values to other fields here */
 }

有了这个:

listeners : {
   "select" : function(combo,data,idx){
        console.info(data);
   }
}
于 2011-08-11T02:30:22.830 回答