Ext.form.FieldContainer
is just container for form field components. If you need that your component will behave like form field it should use Ext.form.field.Field
mixin. In documentation we can read that this mixin provides a common interface for the logical behavior and state of form fields, including:
- Getter and setter methods for field values
- Events and methods for tracking value and validity changes
- Methods for triggering validation
In your test case you also should change getValue
to getSubmitValue
because this method is used by form when it is collecting data from form fields after you call form's submit()
method.
Ext.define('Ext.form.CustomField', {
extend: 'Ext.form.FieldContainer',
alias: 'widget.customfield',
mixins: {
field: 'Ext.form.field.Field'
},
width: 300,
constructor: function(config) {
this.callParent([config]);
},
getValue : function(){
return "test"; // I want to force new value.
},
getSubmitValue: function() {
return "test";
},
setValue : function(val){},
initComponent: function() {
this.items = ([{'xtype' : 'button',text : 'some button'}]);
this.callParent();
}
});
Fiddle with example: https://fiddle.sencha.com/#fiddle/2vp