{
            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里面无效。有用过的么,谢谢指教!

解决方案 »

  1.   

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

  2.   

    在网上查了哈 说的是 combobox只能选择,不能自己输入?我觉得还有其他办法吧
      

  3.   

    你先整一个简单的combo 看在grid里编辑的时候是否存在问题 再一点点找原因
      

  4.   

    这个原因就是 第二次回复的时候说的 combobox不能写入本身数据源之外的数据,也就是说只能从本身选择,否则就被清除。不像easyui那样。所以通过combobox做精确查询,就不能用combobox。希望以后能出一个更自由的版本