1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    61
    Answers
    3
    Vote Rating
    0
    azinyama is on a distinguished road

      0  

    Default Answered: Ext.grid.RowNumberer and Ext.toolbar.Paging

    Answered: Ext.grid.RowNumberer and Ext.toolbar.Paging


    Hi all!!!

    I have a grid panel making use of the row numberer plugin. It shows the row numbers but it fails to increment correctly when I'm paging through the rows (about 3000 rows - limit 100). Here is my code:

    Grid Panel:

    Code:
    Ext.define('Test.view.tariff.TariffWindow',
    {
        extend      : 'Ext.grid.Panel',
        alias       : 'widget.tariffWindow',
        
        title       : 'Tariff Administration',
        
    //    requires    : 
    //    [
    //        'Ext.grid.*',
    //        'Ext.toolbar.Paging'
    //    ],
            
        viewConfig  :
        {
            stripeRows: true
        },
        
        rowEditing  : Ext.create('Ext.grid.plugin.RowEditing'),
        
        initComponent: function() 
        {
            Ext.apply(this, 
            {
                id          : 'tariffWindow',
                closable    : false,
                resizable   : false,            
                draggable   : false,
                border      : false,
                bodyBorder  : false,
                floating    : false,
                frame       : false,
                autoDestroy : true,
                region      : 'center',
                store       : 'Tariff',
                plugins     : [this.rowEditing],
                columns     : [{
                                text        : 'Tariff_RowID',
                                sortable    : false,
                                hideable    : false,
                                hidden      : true,
                                dataIndex   : 'Tariff_RowID'
                            },
                            Ext.create('Ext.grid.RowNumberer'),
                            {
                                text        : 'Tariff Code',
                                width       : 150,
                                sortable    : false,
                                hideable    : false,
                                dataIndex   : 'Tariff_Code',
                                editor      : {
                                                xtype           : 'textfield',
                                                allowBlank      : false,
                                                allowDecimals   : false
                                            }
                            },
                            {
                                text        : 'Description',
                                flex        : 1,
                                sortable    : false,
                                hideable    : false,
                                dataIndex   : 'Tariff_Descr',
                                editor      : {
                                                xtype           : 'textfield',
                                                allowBlank      : false,
                                                allowDecimals   : false
                                            }
                            },
                            {
                                header      : 'NAMAS',
                                width       : 150,
                                sortable    : false,
                                hideable    : false,
                                dataIndex   : 'Tariff_NAMAS',
                                editor      : {
                                                xtype           : 'numberfield',
                                                allowBlank      : false,
                                                allowDecimals   : true,
                                                allowNegative   : false
                                            },
                                renderer    : Ext.util.Format.usMoney
                            },
                            {
                                header      : 'AFHOZ',
                                width       : 150,
                                sortable    : false,
                                hideable    : false,
                                dataIndex   : 'Tariff_AFHOZ',
                                editor      : {
                                                xtype           : 'numberfield',
                                                allowBlank      : false,
                                                allowDecimals   : true,
                                                allowNegative   : false
                                            },
                                renderer    : Ext.util.Format.usMoney
                            },
                            {
                                text        : 'Cash',
                                width       : 150,
                                sortable    : false,
                                hideable    : false,
                                dataIndex   : 'Tariff_Cash',
                                editor      : {
                                                xtype           : 'numberfield',
                                                allowBlank      : false,
                                                allowDecimals   : true,
                                                allowNegative   : false
                                            },
                                renderer    : Ext.util.Format.usMoney
                            }],
                dockedItems : [{
                                xtype   : 'toolbar',
                                dock    : 'top',
                                items   : [{
                                            text    : 'Add',
                                            iconCls : 'icon-add',
                                            action  : 'onAdd'
                                        }, 
                                        '-', 
                                        {
                                            text    : 'Delete',
                                            iconCls : 'icon-delete',
                                            action  : 'onDelete',
                                            disabled: true
                                        }]
                            },
                            {
                                xtype       : 'pagingtoolbar',
                                dock        : 'bottom',
                                store       : 'Tariff',
                                displayInfo : true,
                                displayMsg  : 'Displaying tariffs {0} - {1} of {2}',
                                emptyMsg    : "No tariffs to display"                            
                            }],
                listeners   : {
                                scope           : this,
                                afterRender     : this.onAfterRender,
                                selectionchange : this.onSelectionChange
                            }      
    
            });
                      
            this.callParent(arguments);
        },
    
        onAfterRender: function(grid, eOpts)
        {
            grid.getStore().loadPage(1);
        },
        
        onSelectionChange: function(selmodel, selection)
        {
            var selected = selection[0];
            var button = this.down('button[action=onDelete]');
            
            selected ? button.enable() : button.disable();
        }
    });

  2. Never mind!!! So my mistake. Needed to adjust the with of the column to see the rest of the digits. My bad

  3. #2
    Sencha User
    Join Date
    Oct 2011
    Posts
    61
    Answers
    3
    Vote Rating
    0
    azinyama is on a distinguished road

      0  

    Default


    Never mind!!! So my mistake. Needed to adjust the with of the column to see the rest of the digits. My bad

Tags for this Thread