javascript - Ext.AbstractManager.register(): Registering duplicate id "btnLogout" with this manager -


i have did 1 common view, view required in pages. wherever need, calling view of xtype . within common view have components defined id value.

as per requirement depends on pages need hide button common view again need show. these activities come depending on pages. while first launching time screen come. once navigating page show error ext.abstractmanager.register(): registering duplicate id "btnlogout" manager.

if changed componets id value name value or itemid value. navigate fine problem not able hide , show buttons because showing undefined sysntax var = ext.getcmp('btnbackid'); console.log(a);, undefined. once component returns object, can hide show functionality.

can 1 tell how resolve issue else give me alternate ways achieve. great appreciate. thank you. have given code below

common view

ext.define('abc.view.globalnavigationview', {     extend:'ext.panel.panel',     alias:'widget.globalnavigationview',     id:'globalnavigationid',      layout: {          type: 'vbox',          align:'stretch'      },     items:         [             {                 xtype: 'toolbar',                 layout: 'hbox',                 flex: 1,                 items:                     [                         {                             xtype: 'button',                             flex: .1,                             text: 'back',                             id: 'btnbackid',                                             },                                                  {                             xtype: 'button',                             flex:.1,                             id: 'btnsave',                             cls: 'savecls'                         },                         {                             xtype: 'button',                             flex:.1,                             id: 'btnemail',                             text: 'email'                         },                         {                             xtype: 'button',                             flex:.1,                             id: 'btnprint',                             text: 'print'                         },                         {                             xtype: 'button',                             flex:.1,                             itemid: 'btnfilter',                             text: 'filter'                         },                         {                             xtype: 'button',                             flex:.1,                             id: 'btnlogout',                             cls: 'logoutcls'                         }                     ]             }          ] }); 

homeview1

ext.define('gulfmark.view.weeklyhomeview1', {      extend:'ext.panel.panel',      alias:'widget.weeklyfcastview',      id:'weeklyfcastid',         layout: 'fit',         items:         [            {                 xtype: 'globalnavigationview',                 id: 'globalnavigationweekly1',                 flex: 1,                 docked:"top",                 scrollable:false             },             {                 componets of view                 .........................             }          ] }); 

homeview2

ext.define('gulfmark.view.weeklyhomeview1', {      extend:'ext.panel.panel',      alias:'widget.weeklyfcastview',      id:'weeklyfcastid',         layout: 'fit',         items:         [            {                 xtype: 'globalnavigationview',                 id: 'globalnavigationweekly2',                 flex: 1,                 docked:"top",                 scrollable:false             },             {                componets of view                 -----------------------             }          ] }); 

controller code:

  init:function(){          this.control({             'globalnavigationview ':{                 click:this.onbtnbackclick,                 render: this.onbtnbackrender,             },                         'weeklyfcastview':{                 show:this.onshowweeklyfcastview,                 render:this.onrenderweeklyfcastview             }         });     },     onshowweeklyfcastview: function(){                 var btnfilter = ext.getcmp('btnfilter');         console.log(btnfilter); // if used components id name or itemid, here show undefined         btnfilter.sethidden(true);           //btnfilter .hide();      } 

if view not singleton, cannot give ids components - ids must unique, or duplicate id error.

what need reference view trying show/hide buttons. when have reference, can use down method find buttons. example:

var ipanel = // create new panel here. ipanel.down('button[text="email"]').hide(); 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -