javascript - Show / Hide Button in Sencha Touch 2.3.1 losing reference -
so have problem in sencha touch app. have container defined:
{ xtype: 'container', text: 'something', height: '15%', width: '15%', itemid: 'optionsmenu', hidden: true, style: 'background:red', },
and have listener defined in listeners:
{ fn: 'onoptionsbuttontap', event: 'tap', delegate: '#optionsbutton' }
and onoptionsbuttontap() method:
onoptionsbuttontap: function() { var optionspanel = this.down('#optionsmenu'); console.log(optionspanel.ishidden()); if(optionspanel.ishidden()) { optionspanel.showby(this.down('#optionsbutton')); //optionspanel.addafterlistener('tap', this.onoptionsbuttontap); } else optionspanel.hide(); },
what want when tap button, container appear button. when tapping button next time, getting typeerror, saying optionspanel not have method ishidden(). causing this? tried using panel (hence variable name) giving same error.
i have added name of container.
{ xtype: 'container', text: 'something', name: 'option_menu', height: '15%', width: '15%', hidden: true, style: 'background:red' }
in controller create reference of optionmenu: 'container[name="option_menu"]
option_menu , on tap
event of button call function controller.
onoptionsbuttontap: function(button) { var me = this, optionspanel = me.getoptionmenu(); console.log(optionspanel.ishidden()); if(optionspanel.ishidden()) { optionspanel.showby(button); } else{ optionspanel.hide(); } }
Comments
Post a Comment