Summary.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. Ext.define('saas.override.grid.feature.Summary', {
  2. override: 'Ext.grid.feature.Summary',
  3. // Synchronize column widths in the docked summary Component or the inline summary row
  4. // depending on whether we are docked or not.
  5. afterHeaderCtLayout: function(headerCt) {
  6. var me = this,
  7. view = me.view,
  8. columns = view.getVisibleColumnManager().getColumns(),
  9. column,
  10. len = columns.length,
  11. i, summaryEl, el, width, innerCt;
  12. if (me.showSummaryRow && view.refreshCounter) {
  13. if (me.dock) {
  14. summaryEl = me.summaryBar.el;
  15. width = headerCt.getTableWidth();
  16. innerCt = me.summaryBar.innerCt;
  17. // Stretch the innerCt of the summary bar upon headerCt layout
  18. me.summaryBar.item.setWidth(width);
  19. // headerCt's tooNarrow flag is set by its layout if the columns overflow.
  20. // Must not measure+set in after layout phase, this is a write phase.
  21. if (headerCt.tooNarrow) {
  22. width += Ext.getScrollbarSize().width;
  23. }
  24. innerCt.setWidth(width);
  25. } else {
  26. summaryEl = Ext.fly(Ext.fly(view.getNodeContainer()).down('.' + me.summaryItemCls, true));
  27. }
  28. // If the layout was in response to a clearView, there'll be no summary element
  29. if (summaryEl) {
  30. for (i = 0; i < len; i++) {
  31. column = columns[i];
  32. el = summaryEl.down(view.getCellSelector(column), true);
  33. if (el) {
  34. // 【override】当最后一列为flex且列数较少时会导致合计对不齐的情况
  35. Ext.fly(el).setWidth(column.el.getWidth() || (column.width || (column.lastBox ? column.lastBox.width : 100)));
  36. }
  37. }
  38. }
  39. }
  40. },
  41. });