Sencha Touch - How to hide custom button when touch back button? -
i create custom button in navigation view in homepanel.my project have 3 viewport.when push navigation view , push button custom button hide.but when push navigation view , push showsearchcategory view navigation view , when push button showsearchcategory view in navigation view isn't hide custom button.
where code wrong?
my controller
ext.define('catalog.controller.main', { extend: 'ext.app.controller', config: { refs: { homepanel: 'homepanel', but: 'homepanel #category', categorybutton: 'button[action=categories]', list:'list', homepanellist: 'homepanel #applist', navigationlist: 'navigation #catlist', navigation: 'navigation', showsearchcategorylist: 'showsearchcategory list' }, control: { homepanellist:{ itemtap: 'showapp' }, categorybutton:{ tap: 'showcat' }, homepanel: { back: 'backbuttonhandler' }, navigationlist:{ itemtap: 'showcatquery' }, navigation:{ back: 'backbuttonnav' }, showsearchcategory:{ back: 'backfromcategorylist' }, showsearchcategorylist:{ itemtap: 'showappfromcategory' } } }, backbuttonhandler: function(button){ ext.getcmp('category').show(); }, backbuttonnav: function(button){ ext.getcmp('category').hide(); }, showcat: function(btn){ **<<<<< second view** ext.getcmp('category').hide(); this.gethomepanel().animateactiveitem({ xtype: 'navigation' }, { type:'slide', direction:'up' } ); }, backfromcategorylist: function(button){ ext.getcmp('category').hide(); }, showcatquery: function(list,index,element,record){ **<<<<< third view** ext.getcmp('category').hide(); var catid = record.get('id'); var catname = record.get('name'); this.gethomepanel().push({ xtype: 'panel', title: catname, scrollable: true, stylehtmlcontent: true, layout: { type: 'fit' }, items: [ { catid: catid, xtype: 'showsearchcategory', } ] }); } });
1.hompanel view:
ext.define('catalog.view.home', { extend: 'ext.navigation.view', xtype: 'homepanel', config: { navigationbar: { items: [ { xtype: 'button', text: 'categories', id: 'category', translate: true, translationkey: 'navigationbar.category', align: 'left', action : 'categories' } ] }, title: 'all', iconcls: 'list', cls: 'home', stylehtmlcontent: true, tabbarposition: 'bottom', items:[ { title: "all apps", xtype: 'list', id:'applist', itemtpl: new ext.xtemplate( '<img src="http://61.47.41.108:9999/system/appinfos/appicons/000/000/{id}/original/{appicon_file_name}" width="50" heigh="50" style="float:left;clear:both;"></img>', '<div style="margin-left: 60px;word-wrap: break-word;width:80%;">', '<span style="font-size:16px;">{name}</span><br>', '<span style="font-size:13px;color:#7c7c7c;" id="catname">{categoryname}</span>', '</div>' ), store: { autoload: true, fields: ['id','name','created_at','appicon_file_name','categoryid','categoryname','url_ios','url_android','gallery','description'], sorters: [{ property:'created_at', direction:'desc' }], proxy: { type: 'jsonp', url: 'http://61.47.41.108:9999/appinfos.json', reader:{ type: 'json', rootproperty:'appinfos' } } } } ] } });
2.navigation view:
ext.define('catalog.view.navigation', { extend: 'ext.navigation.view', xtype: 'navigation', requires: ['ext.data.store'], config: { navigationbar: false, title: 'catalog', ui: 'dark', items: [ { xtype: 'list', id: 'catlist', itemtpl: '<span style="font-size:16px;" id="cattname">{name}</span>', store: { storeid: 'mystore', autoload: true, fields: ['id','name'], sorters: [{ property:'name', }], proxy: { type: 'jsonp', url: 'http://61.47.41.108:9999/categories.json', reader:{ type: 'json', rootproperty:'catalog' } } } } ] } });
3.showsearchcategory view:
ext.define('catalog.view.showsearchcategory', { extend: 'ext.navigation.view', xtype: 'showsearchcategory', requires: ['ext.data.store'], config: { catid: null, navigationbar: false, items: [ { xtype: 'list', itemtpl: new ext.xtemplate( '<img src="http://61.47.41.108:9999/system/appinfos/appicons/000/000/{id}/original/{appicon_file_name}" width="50" heigh="50" style="float:left;clear:both;"></img>', '<div style="margin-left: 60px;word-wrap: break-word;width:80%;">', '<span style="font-size:16px;">{name}</span><br>', '<span style="font-size:13px;color:#7c7c7c;" id="catname">{categoryname}</span>', '</div>' ), store: { autoload: true, storeid: 'allapp', fields: ['id','name','created_at','appicon_file_name','categoryid','categoryname','url_ios','url_android','gallery','description'], sorters: [{ property:'created_at', direction:'desc' }], proxy: { type: 'jsonp', url: 'http://61.47.41.108:9999/appinfos.json', reader:{ type: 'json', rootproperty:'appinfos' } } } } ] }, initialize: function() { var sto = ext.getstore('allapp'); sto.clearfilter(); sto.filter('categoryid', this.getcatid()); this.callparent(arguments); } });
ext.define('catalog.view.navigation', { extend: 'ext.navigation.view', xtype: 'navigation', requires: ['ext.data.store'], config: { navigationbar: false, title: 'catalog', ui: 'dark', items: [ { xtype: 'list', id: 'catlist', itemtpl: '<span style="font-size:16px;" id="cattname">{name}</span>', store: { storeid: 'mystore', autoload: true, fields: ['id','name'], sorters: [{ property:'name', }], proxy: { type: 'jsonp', url: 'http://61.47.41.108:9999/categories.json', reader:{ type: 'json', rootproperty:'catalog' } } } } ], listeners:{ painted:function() { ext.getcmp('category').hide(); } } } });
please add listener inside config after items , add painted function in write hide functionality .this work. painted function view , cannot written in controller.
Comments
Post a Comment