Reputation: 4425
I just create my component, based in 'Ext.form.field.Trigger' with this config params:
config: {
selectedId: 0,
selectedRecord: null,
searchControl: '',
displayField: '',
autoSearch: true
},
How can I bind the "selectedId" variable to be send to server as the value of a field of this kind ?
For example:
I have a field in my table: brand_id.
I have in my form, my custom control that needs to send the id of a brand record (just like combobox). This id is in the "selectedId" variable.
Upvotes: 0
Views: 677
Reputation: 15109
You will need to override the getValue()
method of the custom triggerfield
component that you built. Depending on the way the submit method is called, the predefined methods on the form
use the getValue() or
getRawValue()` methods during submission.
If you read the getValue()
doc for the triggerfield, you'll see the following documentation:
Returns the current data value of the field. The type of value returned is particular to the type of the particular field (e.g. a Date object for Ext.form.field.Date), as the result of calling rawToValue on the field's processed String value. To return the raw String value, see getRawValue.
So override the getValue()
method and return whatever you want sent to the server. By default the getValue() will return the underlying html input
field's value property.
Upvotes: 1