fieldLabel : ROLE_PROPERTY.status,
name : 'status',
//id:'status_id',
store : new Ext.data.SimpleStore({
fields : ['key', 'value'],
data : [['0', '激活'], ['1', '未激活'], ['2', '停用']]
}),
displayField : 'value',
valueField : 'key',
mode : 'local',
typeAhead : true,
forceSelection : true,
triggerAction : 'all',
width : 230,
selectOnFocus:true,
editable : false,
mode: 'remote'
---------------------------------------------------
由於第一次使用extjs今天用到給下拉框賦值問題,
剛開始是採用roleForm.form.findField('status').setValue(0),結果就是不行
糾結了很久,在網上也找了很多資料,可是終究不能用。鬱悶。。。。
Ext.getCmp('status').setValue(0);這是大多數人都會採用的方法,可是在我這裏各種試就是不行。 突然間改成roleForm.form.findField('status').setValue(0+"");就可以了。突然間明白了,原來js爲弱類型語言,需要強制轉換。
roleForm.form.findField('status').setValue(obj.toString());和上一句是同樣的效果,這樣寫跟專業一點於是寫出來給保留一下。。。