Threaded View

    You found a bug! We've classified it as EXTJS-7703 . 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
    Sep 2010
    Posts
    98
    Vote Rating
    5
    plleeuwm is on a distinguished road

      0  

    Default [4.1.1] Ext.Editor revertInvalid causes unexpected behavior when set to false.

    [4.1.1] Ext.Editor revertInvalid causes unexpected behavior when set to false.


    4.1.1 Ext.Editor revertInvalid causes the grid to not display the right value after two clicks.


    REQUIRED INFORMATION
    Ext version tested:
    • Ext 4.1.*
    Description:
    • Ext.Editor revertInvalid causes the grid to not display the right value after two clicks.

    Test Case:
    Set revertInvalid to false and use the cell editing plugin.

    Steps to reproduce:
    Invalidate a cell.
    Click on a cell in the invalidated cell's column.
    Blur.
    Invalidated cell is populated with its old value.


    Code:
    Ext.require('*');
    
    Ext.onReady(function() {
        function formatDate(value) {
            return value ? Ext.Date.dateFormat(value, 'M d, Y') : '';
        }
    
    
        Ext.override(Ext.Editor, {
            revertInvalid: false
        });
    
        Ext.define('Plant', {
            extend: 'Ext.data.Model',
            fields: [{
                name: 'common',
                type: 'string'
            }, {
                name: 'botanical',
                type: 'string'
            }, {
                name: 'light'
            }, {
                name: 'price',
                type: 'float'
            }, {
                name: 'availDate',
                mapping: 'availability',
                type: 'date',
                dateFormat: 'm/d/Y'
            }, {
                name: 'indoor',
                type: 'bool'
            }]
        });
    
        var store = Ext.create('Ext.data.Store', {
            autoDestroy: true,
            model: 'Plant',
            proxy: {
                type: 'ajax',
                url: '../SDK/extjs/examples/grid/plants.xml',
                reader: {
                    type: 'xml',
                    record: 'plant'
                }
            },
            sorters: [{
                property: 'common',
                direction: 'ASC'
            }]
        });
    
        var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
            clicksToEdit: 1
        });
    
        var grid = Ext.create('Ext.grid.Panel', {
            store: store,
            columns: [{
                id: 'common',
                header: 'Common Name',
                dataIndex: 'common',
                flex: 1,
                editor: {
                    allowBlank: false
                }
            }, {
                header: 'Light',
                dataIndex: 'light',
                width: 130,
                editor: new Ext.form.field.ComboBox({
                    typeAhead: true,
                    triggerAction: 'all',
                    selectOnTab: true,
                    store: [['Shade', 'Shade'], ['Mostly Shady', 'Mostly Shady'], ['Sun or Shade', 'Sun or Shade'], ['Mostly Sunny', 'Mostly Sunny'], ['Sunny', 'Sunny']],
                    lazyRender: true,
                    listClass: 'x-combo-list-small'
                })
            }, {
                header: 'Price',
                dataIndex: 'price',
                width: 70,
                align: 'right',
                renderer: 'usMoney',
                editor: {
                    xtype: 'numberfield',
                    allowBlank: false,
                    minValue: 0,
                    maxValue: 100000
                }
            }, {
                header: 'Available',
                dataIndex: 'availDate',
                width: 95,
                renderer: formatDate,
                editor: {
                    xtype: 'datefield',
                    format: 'm/d/y',
                    minValue: '01/01/06',
                    disabledDays: [0, 6],
                    disabledDaysText: 'Plants are not available on the weekends'
                }
            }],
            selModel: {
                selType: 'cellmodel'
            },
            renderTo: document.body,
            width: 600,
            height: 300,
            plugins: [cellEditing]
        });
        store.load();
    });
    Last edited by evant; 5 Nov 2012 at 1:26 PM. Reason: Fix up test case.

Thread Participants: 2