Results 1 to 10 of 10

Thread: Column Renderer bug

    You found a bug! We've classified it as EXTJS-14132 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha Premium Member
    Join Date
    Aug 2012
    Posts
    35

    Default Column Renderer bug

    Ext version tested:
    • Ext 5.0.0, 5.0.1.1109
    Description:

    Column renderer will give no metadata parameter after change a value of cell. It happens because column renderer method is invoked with null second parameter here

    Table.js:1942 for Ext 5.0.1.1109
    PHP Code:
    handleUpdate: function(storerecordoperationchangedFieldNames) {
    ....
        if (
    column.renderer) {
             
    value Ext.callback(column.rendererscope,        
                 [
    valuenullrecord00me.dataSourceme], 0columnownerCt);
        } 
    Initially renderer method call from here:

    Table.js:1320 for Ext 5.0.1.1109
    PHP Code:
    renderCell: function (columnrecordrecordIndexrowIndexcolumnIndexout) {
    ...
         if (
    column.renderer && column.renderer.call) {
            
    fullIndex me.ownerCt.columnManager.getHeaderIndex(column);
            
    value column.renderer.call(column.usingDefaultRenderer column column.scope || me.ownerCtfieldValuecellValuesrecordrecordIndexfullIndexme.dataSourceme);
            if (
    cellValues.css) { 
    and the second parameter is passed correct.
    There was no handleUpdate method in Ext 4 so it works fine there.

    Fiddle here: https://fiddle.sencha.com/#fiddle/7hq

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

  3. #3
    Sencha Premium Member
    Join Date
    Apr 2013
    Posts
    20

    Default

    I have the same issue with Ext 5.1.0.107

  4. #4
    Sencha Premium Member
    Join Date
    Aug 2012
    Posts
    35

    Default

    The only way I found - refresh store entirely

  5. #5
    Sencha User
    Join Date
    Jun 2009
    Location
    Heidelberg, Germany
    Posts
    79

    Default Quick and dirty fix

    It's a shame Sencha has not been able to fix this bug within half a year (and with 5.1 being released in the meantime). This bug leaves columnRenderer and the meta object unusable! Having had to study the sources to find a solution for myself, I appreciate that there is no obvious/simple fix, but I still do not understand why such a bug is not treated with more priority. At least a temporary solution or a work around should be provided to those who need it.

    As such, here goes my solution, if anyone else is stuck with this. It works for me (as well as with the fiddle provided in this thread), but it is a bit of a dirty solution, so please be aware of the possibility of side effects. What I did is, remove the not working update code containing the call to column.renderer entirely and replace it with a simple .refresh(). Of course, this refreshes the entire grid which is not necessary, but at least, it works. Changes highlighted in read below.

    Code:
    Ext.define('Ext.overrides.grid.View', {
        override: 'Ext.grid.View',
        handleUpdate: function(store, record, operation, changedFieldNames) {
            var me = this,
                rowTpl = me.rowTpl,
                oldItem, oldItemDom, oldDataRow,
                newItemDom,
                newAttrs, attLen, attName, attrIndex,
                overItemCls,
                focusedItemCls,
                selectedItemCls,
                columns,
                column,
                columnsToUpdate = [],
                len, i,
                hasVariableRowHeight = me.variableRowHeight,
                cellUpdateFlag,
                updateTypeFlags = 0,
                cell,
                fieldName,
                value,
                defaultRenderer,
                scope,
                ownerCt = me.ownerCt;
    
    
            if (me.viewReady) {            
                oldItemDom = me.getNodeByRecord(record);
                
                if (oldItemDom) {
                    overItemCls = me.overItemCls;
                    focusedItemCls = me.focusedItemCls;
                    selectedItemCls = me.selectedItemCls;
                    columns = me.ownerCt.getVisibleColumnManager().getColumns();
                    
                     if (!me.getRowFromItem(oldItemDom) || (updateTypeFlags & 1) || (oldItemDom.tBodies[0].childNodes.length > 1)) {
                        oldItem = Ext.fly(oldItemDom, '_internal');
                        newItemDom = me.createRowElement(record, me.dataSource.indexOf(record), columnsToUpdate);
                        if (oldItem.hasCls(overItemCls)) {
                            Ext.fly(newItemDom).addCls(overItemCls);
                        }
                        if (oldItem.hasCls(focusedItemCls)) {
                            Ext.fly(newItemDom).addCls(focusedItemCls);
                        }
                        if (oldItem.hasCls(selectedItemCls)) {
                            Ext.fly(newItemDom).addCls(selectedItemCls);
                        }
                        
                        if (Ext.isIE9m && oldItemDom.mergeAttributes) {
                            oldItemDom.mergeAttributes(newItemDom, true);
                        } else {
                            newAttrs = newItemDom.attributes;
                            attLen = newAttrs.length;
                            for (attrIndex = 0; attrIndex < attLen; attrIndex++) {
                                attName = newAttrs[attrIndex].name;
                                if (attName !== 'id') {
                                    oldItemDom.setAttribute(attName, newAttrs[attrIndex].value);
                                }
                            }
                        }
    
    
                        if (columns.length && (oldDataRow = me.getRow(oldItemDom))) {
                            me.updateColumns(oldDataRow, Ext.fly(newItemDom).down(me.rowSelector, true), columnsToUpdate);
                        }
                        
                        while (rowTpl) {
                            if (rowTpl.syncContent) {                                                        
                                if (rowTpl.syncContent(oldItemDom, newItemDom, changedFieldNames ? columnsToUpdate : null) === false) {
                                    break;
                                }
                            }
                            rowTpl = rowTpl.nextTpl;
                        }
                    }
                    else {
                        this.refresh();
                    }
                    
                    if (hasVariableRowHeight) {
                        Ext.suspendLayouts();
                    }
    
    
                    me.fireEvent('itemupdate', record, me.store.indexOf(record), oldItemDom);
                    
                    if (hasVariableRowHeight) {
                        me.refreshSize();
                        
                        Ext.resumeLayouts(true);
                    }
                }
            }
        }
    }//<debug>
    , function() {
        if (!Ext.getVersion().match('5.1.0.107')) {
            console.warn('This patch has not been tested with this version of ExtJS');
        }
    }
    //</debug>
    );

  6. #6
    Sencha User
    Join Date
    Dec 2012
    Posts
    5

    Default

    Still evident in 6.0.0 :-(

  7. #7
    Sencha Premium User
    Join Date
    Apr 2015
    Location
    Germany
    Posts
    122

    Default

    We just fell over this issue, too. The API docs doesn't state that metaData can be null here. Please adjust the api docs or better: fix this!

    Thanks in advance.

  8. #8
    Sencha Premium Member
    Join Date
    Feb 2015
    Posts
    44

    Default

    Over two years, has this still not been fixed?

  9. #9
    Sencha User
    Join Date
    Jun 2014
    Location
    Murmansk, Russia
    Posts
    273

    Default

    Bump.

  10. #10
    Sencha User
    Join Date
    Sep 2015
    Posts
    36

    Default

    Seems like this issue is still around in 2018?

Posting Permissions

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