+ -
当前位置:首页 → 问答吧 → Ext4.0 combobox内嵌到grid的问题

Ext4.0 combobox内嵌到grid的问题

时间:2011-09-19

来源:互联网

JScript code

{
            header:'项目明细',
            flex: 1,
            sortable: true,
            dataIndex: 'itemname',
            hideable: true,
        editor : {
                                        
                        xtype: 'combobox',                    
                        displayField: 'itemname',
                        value:'itemname',                    
                        typeAhead: true, 
                        width: 200,
                        labelWidth: 200,
                        store: qureystore, 
                        triggerAction: 'all',
                        valueField : 'itemname',
                        forceSelection :false,
                        selectOnFocus :false,
                        listConfig: {
                                getInnerTpl: function() {
                                return '<div data-qtip="{content}">{itemname}</div>';
                                }
                            },
                        listeners : { 
                                render : function(f) 
                                { 
                                        f.el.on('change', function(e) { 
                                                 f.setValue(f.getValue());
                                                f.setRawValue(f.getValue());    
                                                
                                               qureystore.proxy= new Ext.data.HttpProxy({
                                                        model:'qurey',
                                                        url : "stock_qurey2.asp?name=" + f.getValue(),
                                                        method : 'POST',
                                                        reader : new Ext.data.JsonReader({
                                                        root : "rows",                
                                                        totalProperty : 'total',
                                                        id: 'id'            
                                                        },qurey) 
                                              })//说明数据结构
                                              
                                                qureystore.load();
                                                f.originalValue= f.getValue();
                                                
                                                        
                                        });
                                },
                                select:function(f,records,e)
                                {
                                    
                                }
                        }
                        
            }
        }


现在的问题是当第一次输入新值的时候,combobox正常保存,可当我再次点击刚才输入的编辑框后,combobox会被清空。如果是从combobox选择出来的值就不会出现这种情况。有点迷惑。我猜想,grid每次引用的是同一个combobox对象,每次点击都会被初始化。
我从网上找了很多代码,但没解决问题,之前的版本是用editor :new Ext.form.filed.combocox({})创建,但是在ext4.0里面无效。有用过的么,谢谢指教!

作者: ma1986   发布时间: 2011-09-19

我的问题就是 只要不是从combobox选择出来的值(也就是输入的是新值),在第二次点击的时候就会被清空。有什么办法解决,谢谢

作者: ma1986   发布时间: 2011-09-19

相关阅读 更多