1. #1
    Sencha User
    Join Date
    May 2012
    Location
    Bangalore
    Posts
    95
    Vote Rating
    1
    Rameshlamani is on a distinguished road

      0  

    Default Ext.AbstractManager.register(): Registering duplicate id “btnLogout” with this manage

    Ext.AbstractManager.register(): Registering duplicate id “btnLogout” with this manage


    I have did one common view, this view is required in all the pages. so wherever i need, i am calling this view of xtype . Within this common view have some components with defined by id value. as per requirement depends on pages i need to hide some button from common view again need to show. these activity will come depends on pages. While first launching time screen will come. once i navigating to another page it will show error like Ext.AbstractManager.register(): Registering duplicate id "btnLogout" with this manager. if i changed componets id value to name value or itemId value. then it will navigate fine but problem is not able to hide and show the buttons because showing undefined sysntax is var a = Ext.getCmp('btnBackID'); console.log(a);, it will be undefined. once the component returns as object, i can do hide show functionality. Can any one tell how resolve this issue else give me alternate ways to achieve. great appreciate. Thank you. i have given my code below

    Common View

    Code:
    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'                        }                    ]            }        ]});
    Home View1:

    Code:
    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            },            {                my componets of this view                .........................            }        ]});
    Home View 2

    Code:
    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            },            {               my componets of this view                -----------------------            }        ]});
    Controller Code:
    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 i used components id to name or itemId, here will show undefined        btnFilter.setHidden(true);          //btnFilter .hide();    }

  2. #2
    Sencha User Legolas's Avatar
    Join Date
    Apr 2010
    Location
    Brazil/MG
    Posts
    58
    Vote Rating
    3
    Legolas is on a distinguished road

      1  

    Default


    Quote Originally Posted by Rameshlamani View Post
    Can any one tell how resolve this issue else give me alternate ways to achieve. great appreciate. Thank you. i have given my code below
    Hi Rameshlamani,

    The use of fixed IDs is not a good practice, as your example shows. You can use the class Ext.ComponentQuery to rescue your components. So you can get your components through the attributs. See the example:
    Code:
    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',
                        action: 'back'
                    }, {
                        xtype: 'button',
                        flex: .1,
                        //id: 'btnSave',
                        action: 'save',
                        cls: 'saveCls'
                    }, {
                        xtype: 'button',
                        flex: .1,
                        //id: 'btnEmail',
                        action: 'email',
                        text: 'Email'
                    }, {
                        xtype: 'button',
                        flex: .1,
                        //id: 'btnPrint',
                        action: 'print',
                        text: 'Print'
                    }, {
                        xtype: 'button',
                        flex: .1,
                        //itemId: 'btnFilter',
                        action: 'filter',
                        text: 'Filter'
                    }, {
                        xtype: 'button',
                        flex: .1,
                        //id: 'btnLogout',
                        action: 'logout',
                        cls: 'logoutCls'
                    }
                ]
            }
        ]
    });
    I'm using the attribute action for each button, in your controller you can get the reference by this attribute, like below:
    Code:
    // ADDED A PARAMETER
    onShowweeklyfcastView: function (panel) {
        var btnFilter = panel.down('button[action=filter]');
        console.log(btnFilter); 
    }
    The parameter "panel" is the component "weeklyfcastView", through him I rescue the reference of button.
    I am sorry my english, I am learning yet
    Portuguese blog: http://wessdevel.blogspot.com.br/
    Twitter: @wlegolas

  3. #3
    Sencha User
    Join Date
    May 2012
    Location
    Bangalore
    Posts
    95
    Vote Rating
    1
    Rameshlamani is on a distinguished road

      0  

    Default


    @ Legolas, Thank you very much. I got now it is working fine. Nice solution.

  4. #4
    Sencha User Legolas's Avatar
    Join Date
    Apr 2010
    Location
    Brazil/MG
    Posts
    58
    Vote Rating
    3
    Legolas is on a distinguished road

      0  

    Default


    Quote Originally Posted by Rameshlamani View Post
    @ Legolas, Thank you very much. I got now it is working fine. Nice solution.

    And remember: "The use of fixed IDs is not a good practice"
    I am sorry my english, I am learning yet
    Portuguese blog: http://wessdevel.blogspot.com.br/
    Twitter: @wlegolas

  5. #5
    Sencha User
    Join Date
    May 2012
    Location
    Bangalore
    Posts
    95
    Vote Rating
    1
    Rameshlamani is on a distinguished road

      0  

    Default


    ya, Thank you

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar