Results 1 to 6 of 6

Thread: Grid header creation on set title

  1. #1
    Sencha User
    Join Date
    Apr 2011
    Posts
    15
    Vote Rating
    2
      0  

    Default Grid header creation on set title

    Grid headers were created by doing a setTitle before extjs 4.2.1 .
    For example :

    PHP Code:
    this.setTitle('Titles); 
    would create the header and you could add to the header by

    PHP Code:
        this.header.add({             
                      
    xtype 'button',            
                      
    text :'Button1'
                   
    }); 
    But after migrating to 4.2.1, the header is not getting created by setTitle(); Do we have to manually create the headers ?

  2. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,154
    Vote Rating
    247
      0  

    Default

    The following works ok for me in 4.2.1.

    Code:
    var panel = Ext.create('Ext.panel.Panel', {
        width: 200,
        html: '<p>World!</p>',
        renderTo: Ext.getBody()
    });
    
    
    // add the header with title: 'Hello'
    Ext.defer(function () {
        panel.setTitle('Hello');
    }, 1000);
    
    
    // add a button to the header
    Ext.defer(function () {
        panel.getHeader().add({
            xtype: 'button',
            text: 'Button1'
        });
    }, 2000);
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our human resources manager: fabienne.bell@sencha.com

  3. #3
    Sencha User
    Join Date
    Apr 2011
    Posts
    15
    Vote Rating
    2
      0  

    Default

    The above code does not work for me with version 4.2.1.883

  4. #4
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,154
    Vote Rating
    247
      0  

    Default

    Are you seeing what you were expecting here:
    http://jsfiddle.net/slemmon/ENQYa/

    *using 4.2.1
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our human resources manager: fabienne.bell@sencha.com

  5. #5
    Sencha User
    Join Date
    Apr 2011
    Posts
    15
    Vote Rating
    2
      0  

    Default

    Sorry my mistake, the sample code is working.

    But I have a doubt , when does the header creation occur in 4.2.1 ? Earlier consecutive statements of setTitle and adding to header would work. Now should we add to the header element in the afterrender of the panel ?

  6. #6
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,154
    Vote Rating
    247
      0  

    Default

    I believe you're on the right track - the header doesn't exist until the panel is rendered (or until some other method like setTitle creates it ad hoc).

    Code:
    var panel = Ext.create('Ext.panel.Panel', {
        width: 200,
        html: '<p>World!</p>'
    });
    
    
    
    
    // add the header with title: 'Hello'
    Ext.defer(function () {
        panel.setTitle('Hello');
    }, 1000);
    
    
    
    
    // add a button to the header
    Ext.defer(function () {
        panel.getHeader().add({
            xtype: 'button',
            text: 'Button1'
        });
    }, 2000); // this fails since the header doesn't exist, yet
    
    
    // render the panel
    Ext.defer(function () {
        panel.render(document.body);
    }, 3000);
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our human resources manager: fabienne.bell@sencha.com

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •