[CLOSED] [#609] Ext.grid.feature.Summary bug

  1. #1

    [CLOSED] [#609] Ext.grid.feature.Summary bug

    In your examples for the Ext.grid.feature.Summary feature , there's an alignment bug. If you take a look at your example (https://examples2.ext.net/#/GridPane...group_headers/), the summary row at the bottom is not taking into account the scroll bar width because you are adding instead of subtracting. Please take a look and let me know if a fix is available, thanks.

    This row:

    me.summaryBar.innerCt.setWidth(this.getFullWidth() + Ext.getScrollbarSize().width);
    should be:

    me.summaryBar.innerCt.setWidth(this.getFullWidth() - Ext.getScrollbarSize().width);



    Ext.define('Ext.grid.feature.Summary', {
    
        
    
        extend:  Ext.grid.feature.AbstractSummary ,
    
        alias: 'feature.summary',
    
        
        dock: undefined,
    
        dockedSummaryCls: Ext.baseCSSPrefix + 'docked-summary',
    
        panelBodyCls: Ext.baseCSSPrefix + 'summary-',
    
        init: function(grid) {
            var me = this,
                view = me.view;
    
            me.callParent(arguments);
    
            if (me.dock) {
                grid.headerCt.on({
                    afterlayout: me.onStoreUpdate,
                    scope: me
                });
                grid.on({
                    beforerender: function() {
                        var tableCls = [me.summaryTableCls];
                        if (view.columnLines) {
                            tableCls[tableCls.length] = view.ownerCt.colLinesCls;
                        }
                        me.summaryBar = grid.addDocked({
                            childEls: ['innerCt'],
                            renderTpl: [
                                '<div id="{id}-innerCt">',
                                    '<table cellPadding="0" cellSpacing="0" class="' + tableCls.join(' ') + '">',
                                        '<tr class="' + me.summaryRowCls + '"></tr>',
                                    '</table>',
                                '</div>'
                            ],
                            style: 'overflow:hidden',
                            itemId: 'summaryBar',
                            cls: [ me.dockedSummaryCls, me.dockedSummaryCls + '-' + me.dock ],
                            xtype: 'component',
                            dock: me.dock,
                            weight: 10000000
                        })[0];
                    },
                    afterrender: function() {
                        grid.body.addCls(me.panelBodyCls + me.dock);
                        view.mon(view.el, {
                            scroll: me.onViewScroll,
                            scope: me
                        });
                        me.onStoreUpdate();
                    },
                    single: true
                });
    
                
                grid.headerCt.afterComponentLayout = Ext.Function.createSequence(grid.headerCt.afterComponentLayout, function() {
                      me.summaryBar.innerCt.setWidth(this.getFullWidth() + Ext.getScrollbarSize().width);
                });
            } else {
                me.view.addFooterFn(me.renderTFoot);
            }
    
            grid.on({
                columnmove: me.onStoreUpdate,
                scope: me
            });
    
            
            view.mon(view.store, {
                update: me.onStoreUpdate,
                datachanged: me.onStoreUpdate,
                scope: me
            });
        }
    });
    Attached Thumbnails Click image for larger version. 

Name:	Capture.PNG 
Views:	18 
Size:	1.4 KB 
ID:	17121  
    Last edited by Daniil; Dec 13, 2014 at 8:29 PM. Reason: [CLOSED]
  2. #2
    Hi @stratadev,

    Thank you for the report. Created an Issue.
    https://github.com/extnet/Ext.NET/issues/609

    Please use this fix. I will commit it to SVN within a few days.

    Fix
    Ext.grid.feature.Summary.override({
        init: function(grid) {
            var me = this,
                view = me.view;
    
            me.callSuper(arguments);
    
            if (me.dock) {
                grid.headerCt.on({
                    afterlayout: me.onStoreUpdate,
                    scope: me
                });
                grid.on({
                    beforerender: function() {
                        var tableCls = [me.summaryTableCls];
                        if (view.columnLines) {
                            tableCls[tableCls.length] = view.ownerCt.colLinesCls;
                        }
                        me.summaryBar = grid.addDocked({
                            childEls: ['innerCt'],
                            renderTpl: [
                                '<div id="{id}-innerCt">',
                                    '<table cellPadding="0" cellSpacing="0" class="' + tableCls.join(' ') + '">',
                                        '<tr class="' + me.summaryRowCls + '"></tr>',
                                    '</table>',
                                '</div>'
                            ],
                            style: 'overflow:hidden',
                            itemId: 'summaryBar',
                            cls: [ me.dockedSummaryCls, me.dockedSummaryCls + '-' + me.dock ],
                            xtype: 'component',
                            dock: me.dock,
                            weight: 10000000
                        })[0];
                    },
                    afterrender: function() {
                        grid.body.addCls(me.panelBodyCls + me.dock);
                        view.mon(view.el, {
                            scroll: me.onViewScroll,
                            scope: me
                        });
                        me.onStoreUpdate();
                    },
                    single: true
                });
    
                // Stretch the innerCt of the summary bar upon headerCt layout
                grid.headerCt.afterComponentLayout = Ext.Function.createSequence(grid.headerCt.afterComponentLayout, function() {
                    me.summaryBar.innerCt.setWidth(this.getFullWidth() - Ext.getScrollbarSize().width); // #609
                });
            } else {
                me.view.addFooterFn(me.renderTFoot);
            }
    
            grid.on({
                columnmove: me.onStoreUpdate,
                scope: me
            });
    
            // On change of data, we have to update the docked summary.
            view.mon(view.store, {
                update: me.onStoreUpdate,
                datachanged: me.onStoreUpdate,
                scope: me
            });
        }
    });
  3. #3
    The fix has been committed to the SVN trunk in the revision #6199. It will go to the v2.5.4 release.

    Thank you again for the report!

Similar Threads

  1. Replies: 17
    Last Post: Apr 27, 2016, 12:06 AM
  2. [CLOSED] Summary Feature next to a CheckColumn
    By Peter.Treier in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 11, 2014, 12:14 PM
  3. Grouping summary and summary in one grid
    By PetrSnobelt in forum 2.x Help
    Replies: 1
    Last Post: Apr 16, 2013, 9:59 AM
  4. Replies: 3
    Last Post: Feb 17, 2013, 9:38 AM
  5. Replies: 1
    Last Post: Nov 12, 2012, 2:29 PM

Tags for this Thread

Posting Permissions