0

I'm using Extjs 6.5. I want to implement a picker that have 4 fields: String, Number, Combobox, Color.

I want to save value as an object as follow:

{
   string: 'its my name',
   number: 12,
   combobox: 'combo',
   color: 'ffffffff'
}

That means when you call field.getValue() it return above object, but In field textfield only string value is shown. User can expand picker and edit some fields. I can't understand whats rawToValue and valueToRaw in Ext.form.field.picker? What are these?

Morteza Malvandi
  • 1,656
  • 7
  • 30
  • 73

1 Answers1

0

Basically picker is extend from field and this field have both methods valueToRaw & rawToValue

Hierarchy of extend of picker you can see here ExtJs pickerfield

  • rawTovalue converts a raw input field value into a mixed-type value that is suitable for this particular field type. This allows controlling the normalization and conversion of user-entered values into field-type-appropriate values, e.g. a Date object for Ext.form.field.Date, and is invoked by getValue. It is up to individual implementations to decide how to handle raw values that cannot be successfully converted to the desired object type.

  • valueToRaw converts a mixed-type value to a raw representation suitable for displaying in the field. This allows controlling how value objects passed to setValue are shown to the user, including localization. For instance, for a Ext.form.field.Date, this would control how a Date object passed to setValue would be converted to a String for display in the field.

Narendra Jadhav
  • 10,052
  • 15
  • 33
  • 44