i working in extjs4 mvc.and here stuck @ point want display page , on page suppose there link.and after clicking on link of first view going redirected view.my requirement want reference or alias name of first view or alias when going click on second views button.
here view code:-
1) first view :--
ext.define('app.view.left.wordoftheday', { extend:'ext.panel.panel', alias:'widget.wordoftheday', localized:true, xmore:"more", xtitle:"word of day", initcomponent: function () { ext.apply(this, { title:this.xtitle, items:[ { xtype:'panel', html:'<br>sdf<br>sdfsdf<br>sdsddf<br><a href="#" id="wordofday">'+this.xmore+'</a>', }] }); this.callparent(); } });// end of login class
and design 2)second view design:-
after clicking on first view displays second view.and when clicking on second views keylogin button want reference of first view or alias of first view.. worked on did not solution it.please give me guide line.
one possible solution assign unique id each view, use ext.componentmanager.get('view-id') reference. example:
ext.define('mypanel1', { extend: 'ext.component', xtype: 'mypanel1', id: 'my-panel-1', html: 'panel 1 <a href="#">go</a>', initcomponent: function() { this.on('afterrender', function() { this.getel().down('a').on('click', function() { ext.componentmanager.get('my-panel-2').show(); // go second view this.hide(); }, this); }, this); } }); ext.define('mypanel2', { extend: 'ext.component', xtype: 'mypanel2', id: 'my-panel-2', html: 'panel 2 <a href="#">back</a>', initcomponent: function() { this.on('afterrender', function() { this.getel().down('a').on('click', function() { ext.componentmanager.get('my-panel-1').show(); // first view this.hide(); }, this); }, this); } }); ext.onready(function() { ext.create('ext.container.container', { items: [ { xtype: 'mypanel1', }, { xtype: 'mypanel2', hidden: true, } ], renderto: ext.getbody() }); });
try it on plunker
Comments
Post a Comment