994582796 发表于 2013-1-26 13:33:24

extjs动态改变combobox的editable属性

//我能否在工号(usercode)的listeners里设置 用户权限(priority)的editable为true?怎么设置?直接用setDisabled()等就不能随form.submit()提交了;用setvisible就看不见了。谢谢了!var StudentFormPanel = function() {/**$$$$$ */var Width1=200;var _form=this;this.idTextField = {// xtype : 'hidden',xtype : 'textfield',fieldLabel : "序号",readOnly :true,width:Width1,name : "id"};this.usercodeTextField = {xtype : 'textfield',fieldLabel : "工号",allowBlank : false,maxLength:10,minLength:1,width:Width1,regex: /^{4,4}$/,regexText:'只能输入四位数字!',name : "usercode",listeners : {'blur' : function (t, e) {//我能否在此处设置 用户权限(priority)的editable为true?怎么设置?直接用setDisabled()等就不能随form.submit()提交了;用setvisible就看不见了。谢谢了! //var form = Ext.getCmp('regform');var code = _form.getForm().findField("usercode").getValue();if (code != '') {   Ext.Ajax.request({   url : 'yh.myaction?method=chkUsercode',//method : 'post',   params : {   usercode : code   },   success : function(response, options) {   var responseArray = Ext.util.JSON.decode(response.responseText);if (responseArray.message) {   //isUserCodeOK = false;   _form.form.findField("usercode")   .markInvalid('工号已被使用!');   } else {   //isUserCodeOK = true;   _form.form.findField("usercode").clearInvalid();   }   },failure:function(response, options){Ext.Msg.alert('提示', '后台错误!');}   })    }   }}};this.passwordTextField = {xtype : 'textfield',fieldLabel : "密码",allowBlank : false,maxLength:10,minLength:1,//inputType: 'password',width:Width1,regex:/^.{4,8}$/,regexText:'长度4-8位',name : "password"};this.usernameTextField = {xtype : 'textfield',fieldLabel : "姓名",allowBlank : false,maxLength:10,minLength:1,width:Width1,name : "username"};this.sbpartidtTextField = {xtype: 'combo',fieldLabel: '部门',name: 'sbpartidt',store:dsBm,mode: 'local',triggerAction: 'all',valueField: 'value',displayField: 'text',width:Width1,editable:false,    hiddenName:'sbpartid'};this.tjflagtTextField = {xtype: 'combo',fieldLabel: '统计标志',name: 'tjflagt',store: new Ext.data.SimpleStore({fields: ['value', 'text'],data : [['0', '否'],['1', '是']]}),mode: 'local',triggerAction: 'all',valueField: 'value',displayField: 'text',editable :false,width:Width1,hiddenName:'tjflag'};this.priorityTextField = {xtype: 'lovcombo',fieldLabel: '用户权限',name: 'priorityt',store:new Ext.data.SimpleStore({fields: ['value', 'text'],data : [['t', '填报'],['c', '查询'],['s', '审核'],['g', '管理'],['j', '统计']]}),//填报t,查询c,审核s,管理g,统计jmode: 'local',triggerAction: 'all',valueField: 'value',displayField: 'text',editable :false,width:Width1,hiddenName:'priority'};StudentFormPanel.superclass.constructor.call(this, {bodyStyle : 'padding:5px 5px 0',frame : true,labelWidth:55,reader : new Ext.data.JsonReader( {root : 'list',successProperty : 'success',totalProperty : 'totalSize',id : 'id'}, ['id','usercode','password','username','sbpartid','tjflag','priority']),/**$$$$$ */items : });}Ext.extend(StudentFormPanel, Ext.form.FormPanel, {loadData : function(id) {var url = thisServlet + '?method=edit&id=' + id;/**$$$$$ */this.getForm().load( {url : url,waitMsg : 'Loading',failure : function(form, action) {var json = action.response.responseText;var o = eval("(" + json + ")");Ext.MessageBox.show( {title : 'Error',msg : o.message,buttons : Ext.MessageBox.OK,icon : Ext.MessageBox.ERROR});}});}}); // 配置 readOnly:trueblur : function(obj){    obj.getEl().dom.readOnly = true;}
页: [1]
查看完整版本: extjs动态改变combobox的editable属性