PDA

View Full Version : [CLOSED] [#609] Ext.grid.feature.Summary bug



stratadev
Dec 11, 2014, 2:33 PM
In your examples for the Ext.grid.feature.Summary feature , there's an alignment bug. If you take a look at your example (http://examples2.ext.net/#/GridPanel/Locking_Grid/GroupingSummary_with_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);

http://forums.ext.net/attachment.php?attachmentid=17121&stc=1




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.afterCom ponentLayout, 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
});
}
});

Daniil
Dec 12, 2014, 10:35 PM
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.afterCom ponentLayout, 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
});
}
});

Daniil
Dec 13, 2014, 9:29 PM
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!