July 2015
Beginner
452 pages
8h 34m
English
In Ext JS version 5, the Trigger field was deprecated, and now triggers are set inside text fields. So now, we can add one or many triggers to a single field.
In order to work with triggers, let's write the following code:
var myTriggers = Ext.create( 'Ext.form.field.Text' , {
fieldLabel: 'My Field with triggers',
triggers: {
searchtext: {
cls: 'x-form-search-trigger',
handler: function() {
Ext.Msg.alert('Alert', 'Trigger search was clicked');
this.setValue('searching text...');
}
},
cleartext: {
cls: 'x-form-clear-trigger',
handler: function() {
Ext.Msg.alert('Alert', 'Trigger clear was clicked');
this.setValue('');
}
}
}
});
newItems.push( myTriggers );First, we created an instance of the Ext.form.field.Text class, and set ...
Read now
Unlock full access