Results 1 to 2 of 2

Thread: Grid update fails after adding column.Widget

  1. #1
    Sencha Premium User sb007's Avatar
    Join Date
    May 2012
    Posts
    5

    Question Grid update fails after adding column.Widget

    Hello everybody!
    I use ExtJS 6.7 and I get an error when I try to update a grid with Ext.grid.column.Widget
    Please help me to understand how to solve this.

    Error comes after callJoined method:
    Code:
    record.callJoined('afterCommit', [fieldName]);

    Here is specific description.
    Grid contains several simple columns and dynamic-added column.widget:
    Code:
    var column = Ext.create('Ext.grid.column.Widget', {
                    text  : '...',
                    width : 200,
                    onWidgetAttach: function(column, widget, record) {
                         // simple operations
                    },
                    widget: {
                        xtype   : 'button',
                        text    : '...',
                        listeners: {
                            click: function(me, event, eOpts) {
                                // simple operations
                            }
                        }
                    }
                });
    Then I attach it to a main Ext.grid.Panel component like this:
    Code:
    grid.headerCt.insert(2, column);
    On this stage everything is nice, column with buttons are shown and acts well, but...
    There is some additional functionality - window which is opened by clicking on other cell (gridcolumn), it uses ViewController and on onCellclick it calls:
    Code:
    record.callJoined('afterCommit', [fieldName]);
    And then a crash:
    NKqlL.png


    Tracing shows that crash occurs here (ext-all-rtl-debug.js):

    Code:
    updateColumns: function(oldRow, newRow, columnsToUpdate, record) {
    ...
    // Replace changed cells in the existing row structure with the new version
    // from the rendered row.
    for (colIndex = 0; colIndex < colCount; colIndex++) {
        column = columnsToUpdate[colIndex];
        // Pluck out cells using the column's unique cell selector.
        // Because in a wrapped row, there may be several TD elements.
        cellSelector = me.getCellSelector(column);
        oldCell = oldRow.querySelector(cellSelector);
        newCell = newRow.querySelector(cellSelector);
        // Copy new cell attributes across.
        newAttrs = newCell.attributes; // HERE IS THE CLUE????
                                                         // for the gridcolumn attributes are full, but for widgetcolumn they are null
        attLen = newAttrs.length;
        for (attrIndex = 0; attrIndex < attLen; attrIndex++) {
            attName = newAttrs[attrIndex].name;
            value = newAttrs[attrIndex].value;
            if (attName !== 'id' && oldCell.getAttribute(attName) !== value) {
                oldCell.setAttribute(attName, value);
            }
        }

    What I need to do to solve the error?
    This is a huge project with dynamic grid constructor so I can't produce it in fiddle.

  2. #2
    Sencha Premium User sb007's Avatar
    Join Date
    May 2012
    Posts
    5

    Default

    The problem is solved by adding necessary parameter to Ext.grid.column.Widget object:


    dataIndex: 'WidgetColumn',

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •