By Alvin Alexander. Last updated: June 6, 2016
onStockFormKeyPress: function(textfield, event, options) { if(event.getKey() == event.ENTER) { Ext.Msg.alert('Keys','You pressed the Enter key'); } }
This function is called when the keypress
event is handled in the init
function of my controller class:
init: function(application) { // add the components and events we listen to this.control({ 'stockList': { render: this.onRender }, 'stockList button#delete': { click: this.onDeleteStockButtonClicked }, // 'companyName' refers to the itemId 'stockform textfield#companyName': { //handle Enter on the companyName textfield keypress: this.onStockFormKeyPress }, }); if (!Ext.getStore('Stocks')) { Ext.create('Finance.store.Stocks'); } },