Ext组件ComboBox 中getValue()和getRawValue()的区别

当把Ext.form.ComboBox 的editable 设为true之后,用getValue()是取不到人工打进去(edit)的值的。因此,对于带可编辑功能的ComboBox,我们可以用getRawValue() 去取得值。

我们先来看看两个Method的原型和说明:

getRawValue() : Mixed

Returns the raw data value which may or may not be a valid, defined value. To return a normalized value see getValue().

getValue() : String

Returns the currently selected field value or empty string if no value is set.

注意:虽然getValue()返回的类型是String,而getRawValue()返回的是Mixed,但是这个Mixed可以被当作String运算和处理。

 

getValue是从ComboBox的store中用getById取数据,如果不选择,getById返回的是undefined!

你可能感兴趣的:(combox,getvalue,getrawvalue)