导航

EditorGridPanel 下拉框编辑,显示值,隐藏值问题

Posted on 2013-05-30 09:44  小强有毒  阅读(527)  评论(0)    收藏  举报
editor : new Ext.form.ComboBox({
  allowBlank:false,
  editable:false,
  blankText : '采购单位不能为空',
  triggerAction : 'all',
  valueField : 'id',
  displayField : 'name',
  mode : 'remote',
  getRawValue:function(){//重写getRawValue()方法使其获取显示值
    if(this.valueField){
      return Ext.isDefined(this.value)?this.value:"";
    }else{
      return Ext.form.ComboBox.superclass.getValue.call(this);
    }
  },
  getValue:function(){//重写getValue()方法使其获取隐藏值 //在EditorGridPanel中,combo调用的是此方法,但是只能获取隐藏值
    var a = this.rendered?this.el.getValue():Ext.value(this.value,"");
    if(a===this.emptyText){
      a="";
    }
      return a;
    },
  store : new Ext.data.Store({
    url : '${ctx}/admin/getDictionaryList.do?code=MeasureUnit',
    reader : new Ext.data.JsonReader({
      root : 'list'
    },[
      {name : 'id',type : 'string'},
      {name : 'name',type : 'string'}   
    ])
  }),
  listeners:{
    'select' : function(e){
                                
    }
  }
})