1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    61
    Vote Rating
    2
    cahello is on a distinguished road

      0  

    Default Unanswered: Changing the Panel Header Title on an Event

    Unanswered: Changing the Panel Header Title on an Event


    Hi,

    I have a panel which is updated on another grid's row double click. Everything changes except for the title of the panel. Here is the code:

    Code:
    listeners : {
    		itemdblclick: function(dv, record, item, index, e) {
                    Ext.getCmp('panel1').setTitle('Title changed'); //this does not work
                     }
    }
    The error: 'Cannot call method 'setTitle' of undefined'.

    What am I missing here?

    'panel1' is defined in another .js file where I have also defined 'panel1' as a global variable in the .js file. The code is:

    Code:
    var panel1= Ext.create('Ext.panel.Panel',{
    		autoshow : true,
                    id: 'panel1',
    		name: 'panel1',
    		renderTo : 'panelview',
    		layout : 'border',
    		height: 400,
    		title: 'CANT CHANGE THE TITLE',
    		items : [{
    			xtype: 'panel',
    			align: 'stretch',
    			region:'center',
                            ........
                   }]
    });

  2. #2
    Sencha User
    Join Date
    Jul 2012
    Posts
    33
    Answers
    4
    Vote Rating
    4
    Alexander Bauer is on a distinguished road

      0  

    Default


    For some reason the component manager cant find the component with id 'panel1'. If you do such queries always wrap it with a if(), it may fail updating the tile but at least the app will continue to work.

    You have defined the renderTo property, it may overrides the origin id and becomes
    panelview.

  3. #3
    Sencha User
    Join Date
    May 2012
    Posts
    61
    Vote Rating
    2
    cahello is on a distinguished road

      0  

    Default


    But how do I integrate the code to update the title of my panel header on dblclick event?

  4. #4
    Sencha User
    Join Date
    Jul 2012
    Posts
    33
    Answers
    4
    Vote Rating
    4
    Alexander Bauer is on a distinguished road

      0  

    Default


    try it with Ext.getCmp('panelview') instead.

    Keep in mind: working with ids is a bad approach, it will getting fuzzy when the project grows. You may want to re-think your layout logic and check out the component query in the docs.

  5. #5
    Sencha User
    Join Date
    May 2012
    Posts
    61
    Vote Rating
    2
    cahello is on a distinguished road

      0  

    Default


    The error does not come anymore but the title does not change either. I have used : Ext.getCmp('panelview').setTitle('Title changed'); instead of Ext.getCmp('panel1').setTitle('Title changed');

    I dblclick on one of the grid rows of the other grid panel but the title of this panel does not change.

  6. #6
    Sencha User
    Join Date
    Jul 2012
    Posts
    33
    Answers
    4
    Vote Rating
    4
    Alexander Bauer is on a distinguished road

      0  

    Default


    please try:

    console.log(Ext.getCmp('panelview'));
    console.log(Ext.getCmp('panel1'));
    and check if you get the right panel component.
    If not, it must be some other issue.

  7. #7
    Sencha User
    Join Date
    May 2012
    Posts
    61
    Vote Rating
    2
    cahello is on a distinguished road

      0  

    Default


    I checked that and I am getting some dom null error.

  8. #8
    Sencha User
    Join Date
    May 2012
    Posts
    61
    Vote Rating
    2
    cahello is on a distinguished road

      0  

    Default


    I got this working. It seems that I was allocating the wrong global variable. Thanks for the help.

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