extjs 网格对接错误摘要

rqenqsqc  于 2022-11-05  发布在  其他
关注(0)|答案(2)|浏览(143)

这是我的第一个问题,我会尽量准确。
我将我的应用程序从ExtJS 6.2更新到ExtJS 6.5,发现了一个错误:摘要在停靠时无法正常工作。
我创建了一个 Sencha Fiddle显示该问题,我要求官方支持网站,他们会试图找到一个解决方案,同时我必须解决我的问题自主。
我可以降级到ExtJS 6. 2,但即使是那个版本也有几个bug需要解决,所以我更喜欢总是使用最新的。
所以,问题是:有人遇到过同样的问题吗?我听说这是一个回归,因为它在4.5版本或类似的版本中得到了解决,但我对这个框架还很陌生(也就是说,我一个月前才开始使用ExtJS)。
你能给我一个解决办法吗?任何有用的东西,调试的起点?
我没有太多时间来完成应用程序,如有任何建议将不胜感激(例如,我应该尝试调试摘要还是开始开发自定义组件?)

bf1o4zei

bf1o4zei1#

试试这个覆盖。

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;
                }
            }
        }
    }
}

});

x7rlezfr

x7rlezfr2#

此处出现相同的问题,似乎在网格重新配置事件后未触发数据更改事件。
将以下内容添加到网格中以确认:

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

相关问题