Ext.form.Field.getRawValue() Ext.form.Field.getValue()
ExtJS的ComboBox是一个更接近Form程序的ComboBox的控件,因为它除了有正常的下拉式选择框之外,还支持键盘输入,等于是textbox和comboBox的结合。此外,ExtJS的ComboBox还支持对选项的自动联想。
但是当把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运算和处理。