网格上的错误停靠摘要

时间:2017-06-12 10:05:52

标签: javascript extjs datagrid extjs6 dock

这是我的第一个问题,我会尽量准确。

我将我的应用程序从ExtJS 6.2更新到ExtJS 6.5,我发现了一个错误:在网格中,摘要在停靠时无法正常工作。

我创建了一个显示该问题的Sencha Fiddle,我向官方支持网站询问,他们会尝试找到解决方案,同时我必须自动解决我的问题。

我可以降级到ExtJS 6.2,但即使使用该版本也有几个问题需要解决,所以我更喜欢使用最新版本。

所以,问题是:有人有同样的问题吗?我听说这是一个回归,因为它在版本4.5或类似的东西中解决了,但我对这个框架很新(即我一个月前开始使用ExtJS)。

你能建议我一个解决方法,有用的东西,一个调试的起点吗?

我没有太多时间来完成申请,我们将不胜感激任何建议(例如,我应该尝试调试摘要还是开始开发自定义组件?)

2 个答案:

答案 0 :(得分:0)

此处出现相同问题,似乎在网格重新配置事件后没有触发datachange事件。

将此添加到您的网格以确认:

listeners: {
    reconfigure: function(grid, store) {
          store.fireEvent('datachanged', store);
    }
},

答案 1 :(得分:0)

尝试此覆盖。

Ext.define('Ext.grid.feature.Summary', {
override: 'Ext.grid.feature.Summary',
afterHeaderCtLayout: function (headerCt) {
    var me = this,
        view = me.view,
        columns = view.getVisibleColumnManager().getColumns(),
        column,
        len = columns.length, i,
        summaryEl,
        el, width, innerCt;

    if (me.showSummaryRow && view.refreshCounter) {
        if (me.dock) {
            summaryEl = me.summaryBar.el;
            width = headerCt.getTableWidth();
            innerCt = me.summaryBar.innerCt;
            //if summary is docked item getAll available columns.
            columns = view.getColumnManager().getColumns();
            len = columns.length;
            // Stretch the innerCt of the summary bar upon headerCt layout
            me.summaryBar.item.setWidth(width-1);

            // headerCt's tooNarrow flag is set by its layout if the columns overflow.
            // Must not measure+set in after layout phase, this is a write phase.
            if (headerCt.tooNarrow) {
                width += Ext.getScrollbarSize().width;
            }
            innerCt.setWidth(width-1);
        } else {
            summaryEl = Ext.fly(Ext.fly(view.getNodeContainer()).down('.' + me.summaryItemCls, true));
        }
        // If the layout was in response to a clearView, there'll be no summary element
        if (summaryEl) {
            for (i = 0; i < len; i++) {
                column = columns[i];
                el = summaryEl.down(view.getCellSelector(column), true);
                var colWidth = column.getWidth(),
                    display = column.hidden ? "none" : 'table-cell';
                if (el) {
                    Ext.fly(el).setWidth(colWidth||column.width || (column.lastBox ? column.lastBox.width : 100));
                } else if (me.dock) {
                    //if docked summary and cell does not exists in docked summaryBar then create new cell for that column
                    var row = me.summaryBar.item.dom.rows[0];
                    if (row) {
                        row.insertCell(i);
                        var newCell = row.cells[i];
                        if (newCell) {
                            //apply cell class and columnId attributes for newly added cells.
                            var columnId = column.id;
                            newCell.setAttribute('class', 'x-grid-cell x-grid-td x-grid-cell-' + columnId + ' x-unselectable');
                            newCell.setAttribute('data-columnid', columnId);
                            el = summaryEl.down(view.getCellSelector(column), true);
                            if (el) {
                                //set the column width to cell.
                                Ext.fly(el).setWidth(colWidth || column.width || (column.lastBox ? column.lastBox.width : 100));
                            }
                        }
                    }
                }
                if (me.dock&&el) {
                    //show/hide summary cells based on column status.
                    el.style.display = display;
                }
            }
        }
    }
}

});