标签:mode get 应该 list bbr ext set code states
// The data store containing the list of states var states = Ext.create(‘Ext.data.Store‘, { fields: [], //store 的 fields属性可以为空 //combo可以根据data来创建model data : [ {"abbr":"AL", "name":"Alabama"}, {"abbr":"AK", "name":"Alaska"}, {"abbr":"AZ", "name":"Arizona"} //... ] }); { xtype:‘combo‘, id:‘myCombo‘, fieldLabel: ‘Choose State‘, store: states, queryMode: ‘local‘, //默认为remote , 所以,要改成local displayField: ‘name‘, valueField: ‘abbr‘, } log( Ext.getCmp(‘myCombo‘).getValue() ); //AK valueField log( Ext.getCmp(‘myCombo‘).getRawValue() ); //Alaska displayField
Ext.getCmp(‘myCombo‘).setValue(); //参数应该是valueField,其displayField会跟着改变
由以上代码可知,combo的getValue 方法获取的是valueField ,getRawValue获取的是displayField
标签:mode get 应该 list bbr ext set code states
原文地址:https://www.cnblogs.com/oy-lee/p/11910707.html