You found a bug! We've classified it as EXTJSIV-7703 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User
    Join Date
    Sep 2010
    Posts
    59
    Vote Rating
    3
    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.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,684
    Vote Rating
    435
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Thanks for the report.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.