1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    5
    Vote Rating
    0
    CE_REAL is on a distinguished road

      0  

    Default Unanswered: How to configure a grid toolbar from a container create config

    Unanswered: How to configure a grid toolbar from a container create config


    I'd like to configure my toolbar which I have defined in a grid define:

    Code:
    var grid = Ext.define('Writer.Grid', {
        extend: 'Ext.grid.Panel',
        alias: 'widget.writergrid',
    
    
        initComponent: function() {
    
    
            Ext.apply(this, {
                ...
                tbar: ['->', {
                    text: 'Print',
                    iconCls: 'icon-print',
                    handler : function(){
                        Ext.ux.grid.Printer.printAutomatically = true;
                        Ext.ux.grid.Printer.print(Ext.ComponentQuery.query('writergrid[itemId=grid]')[1]);
                    }
                }]
            });
        }
    }
    from the container create config when creating the container which holds the grid:

    Code:
    var main = Ext.create('Ext.container.Container', {
        renderTo: Ext.Element.get('invoice-summary'),
        layout: 'fit',
        height: 400,
        autoHeight: true,
        items: [{
            itemId: 'grid',
            xtype: 'writergrid',
            flex: 1,
            store: store
        }]
    });

  2. #2
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    Try to fix your code as below:
    Code:
    var grid = Ext.define('Writer.Grid', {
        extend: 'Ext.grid.Panel',
        alias: 'widget.writergrid',
    
    
        initComponent: function() {
    
    
            Ext.apply(this, {
                ...
                tbar: ['->', {
                    text: 'Print',
                    iconCls: 'icon-print',
                    handler : function(){
                        Ext.ux.grid.Printer.printAutomatically = true;
                        Ext.ux.grid.Printer.print(Ext.ComponentQuery.query('writergrid[itemId=grid]')[1]);
                    }
                }]
            });
    
    
            this.callParent(arguments);
        }
    }

Thread Participants: 1

Tags for this Thread