I have a button in the Sencha Touch 2 project. The button will be destroyed with the view after clicking and will be restored after clicking another button.
But the button does not get the listener again.
the listener builds in the view controller.
Ext.application({ name: 'App', controllers: ['Main','Home'], views: ['Main','Home'], launch: function () {Ext.Viewport.add({xtype:'mainview'});} });
controller
Ext.define('App.controller.Home', {extend: 'Ext.app.Controller', config: { refs: {homeView: '#homeview',backBtn: '#btn_test1'}, control: { backBtn: { tap: function(backBtn){ console.log('[Controller][Home] btn monatsrate - - tap'); Ext.Viewport.add({xtype: 'mainview'}); Ext.Viewport.setActiveItem(1); } }, homeView: { deactivate: function (homeView){ console.log('[Controller][Home] autodestroy homeview'); //homeView.destroy(); Ext.Viewport.remove(homeView); } } } }, });
And submission
Ext.define("App.view.Main", { extend:"Ext.Container", xtype:"mainview", config:{ id:'mainview', items:[ { xtype:'button', id:'btn_test2', text: 'test2' } ] },
});
Any idea how to allow the button to return the listener?
source share