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.
You will need to override the
getValue()method of the customtriggerfieldcomponent that you built. Depending on the way the submit method is called, the predefined methods on theformuse thegetValue() orgetRawValue()` methods during submission.If you read the
getValue()doc for the triggerfield, you’ll see the following documentation:So override the
getValue()method and return whatever you want sent to the server. By default the getValue() will return the underlying htmlinputfield’s value property.