1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    90
    Answers
    2
    Vote Rating
    2
    darkhorni is on a distinguished road

      0  

    Default Answered: Updating (seting) column herder

    Answered: Updating (seting) column herder


    I have tried to set column header with these codes but they didn't work. I couldn't figure out what to do.

    PHP Code:
    this.headerCt.setColumnHeader(2,"Surname");
    grid.getColumnModel().setColumnHeader(2,"Surname"); 

  2. You can get column by itemId and rename header text:
    PHP Code:
    Ext.create('Ext.data.Store', {
        
    storeId:'simpsonsStore',
        
    fields:['name''email''phone'],
        
    data:{'items':[
            { 
    'name''Lisa',  "email":"lisa@simpsons.com",  "phone":"555-111-1224"  },
            { 
    'name''Bart',  "email":"bart@simpsons.com",  "phone":"555-222-1234" },
            { 
    'name''Homer'"email":"home@simpsons.com",  "phone":"555-222-1244"  },
            { 
    'name''Marge'"email":"marge@simpsons.com""phone":"555-222-1254"  }
        ]},
        
    proxy: {
            
    type'memory',
            
    reader: {
                
    type'json',
                
    root'items'
            
    }
        }
    });

    Ext.create('Ext.grid.Panel', {
        
    title'Simpsons',
        
    storeExt.data.StoreManager.lookup('simpsonsStore'),
        
    columns: [
            { 
    itemId'col1'header'Name',  dataIndex'name' },
            { 
    header'Email'dataIndex'email'flex},
            { 
    header'Phone'dataIndex'phone' }
        ],
        
    height200,
        
    width400,
        
    renderToExt.getBody(),
        
    tbar: [{
            
    text'Rename 1st column',
            
    handler: function (btn) {
                var 
    grid btn.up('grid'),
                    
    col grid.down('#col1');
                
                
    console.log(gridcol);
                
    col.setText('Renamed');
            }
        }]
    }); 

  3. #2
    Sencha User
    Join Date
    May 2011
    Location
    Ukraine, Rivne
    Posts
    247
    Answers
    44
    Vote Rating
    42
    redraid has a spectacular aura about redraid has a spectacular aura about redraid has a spectacular aura about

      1  

    Default


    You can get column by itemId and rename header text:
    PHP Code:
    Ext.create('Ext.data.Store', {
        
    storeId:'simpsonsStore',
        
    fields:['name''email''phone'],
        
    data:{'items':[
            { 
    'name''Lisa',  "email":"lisa@simpsons.com",  "phone":"555-111-1224"  },
            { 
    'name''Bart',  "email":"bart@simpsons.com",  "phone":"555-222-1234" },
            { 
    'name''Homer'"email":"home@simpsons.com",  "phone":"555-222-1244"  },
            { 
    'name''Marge'"email":"marge@simpsons.com""phone":"555-222-1254"  }
        ]},
        
    proxy: {
            
    type'memory',
            
    reader: {
                
    type'json',
                
    root'items'
            
    }
        }
    });

    Ext.create('Ext.grid.Panel', {
        
    title'Simpsons',
        
    storeExt.data.StoreManager.lookup('simpsonsStore'),
        
    columns: [
            { 
    itemId'col1'header'Name',  dataIndex'name' },
            { 
    header'Email'dataIndex'email'flex},
            { 
    header'Phone'dataIndex'phone' }
        ],
        
    height200,
        
    width400,
        
    renderToExt.getBody(),
        
    tbar: [{
            
    text'Rename 1st column',
            
    handler: function (btn) {
                var 
    grid btn.up('grid'),
                    
    col grid.down('#col1');
                
                
    console.log(gridcol);
                
    col.setText('Renamed');
            }
        }]
    }); 

Thread Participants: 1

Tags for this Thread