Results 1 to 3 of 3

Thread: setValue() method doesn't work in rowEditing's beforeedit event

    Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Sencha User hexawing's Avatar
    Join Date
    Nov 2009
    Posts
    73
    Vote Rating
    0
      0  

    Default setValue() method doesn't work in rowEditing's beforeedit event

    REQUIRED INFORMATION
    Ext version tested:
    • Ext 4.0.2 4.0.7

    Browser versions tested against:
    • FF6.0.2 (firebug 1.8.4 installed)

    DOCTYPE tested against:
    • ____

    Description:
    • When I set a value to a cell in the "beforeedit" event of rowEditing plugin, it doen's work, but if I run the same code in the "change" event of another cell, it works.

    Steps to reproduce the problem:
    • dbclick to edit the grid's line 1

    The result that was expected:
    • line 1 cell 2 was set to "3" and disabled

    The result that occurs instead:
    • line 1 cell 2 was disabled but its value remains

    Steps to reproduce the problem:
    • edit the grid's line 1 cell 1 to any other value

    The result that was expected:
    • line 1 cell 2 was set to "3" and disabled

    The result that occurs instead:
    • as expected

    Test Case:
    Code:
     var quoteItemRowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
        clicksToEdit: 2,
        autoCancel: false,
        listeners: {
            beforeedit: function(){
                Ext.getCmp('col_email').getEditor().setValue("3");
                Ext.getCmp('col_email').getEditor().setDisabled(true);
            }
        }
    });
    
    Ext.create('Ext.data.Store', {
        storeId: 'simpsonsStore',
        fields: ['name', 'email', 'phone'],
        data: {
            'items': [
                {
                "name": "Lisa",
                "email": "lisa@simpsons.com",
                "phone": "555-111-1224"},
            {
                "name": "Bart",
                "email": "bart@simpsons.com",
                "phone": "555--222-1234"},
            {
                "name": "Homer",
                "email": "home@simpsons.com",
                "phone": "555-222-1244"},
            {
                "name": "Marge",
                "email": "marge@simpsons.com",
                "phone": "555-222-1254"}
            ]
        },
        proxy: {
            type: 'memory',
            reader: {
                type: 'json',
                root: 'items'
            }
        }
    });
    
    Ext.create('Ext.grid.Panel', {
        title: 'Simpsons',
        store: Ext.data.StoreManager.lookup('simpsonsStore'),
        plugins: [quoteItemRowEditing],
        columns: [
            {
            header: 'Name',
            id: 'col_name',
            dataIndex: 'name',
            editor: {
                listeners: {
                    change: function(){
                        Ext.getCmp('col_email').getEditor().setValue("3");
                    }
                }
            }},
        {
            header: 'Email',
            id: 'col_email',
            dataIndex: 'email',
            flex: 1,
            editor: {}},
        {
            header: 'Phone',
            id: 'col_phone',
            dataIndex: 'phone'}
        ],
        height: 200,
        width: 400,
        renderTo: Ext.getBody()
    });
    HELPFUL INFORMATION Screenshot or Video:

    See this URL for live test case: http://jsfiddle.net/hexawing/mf2jH/9/ Debugging already done:
    • none

    Possible fix:
    • not provided

    Additional CSS used:
    • only default ext-all.css

    Operating System:

    • WinXP Pro

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,422
    Vote Rating
    1271
      0  

    Default

    I changed Ext JS version to 4.0.7. I started an edit and the email did not change. I edited the Name field and it changed the email value. This done on the Marge row.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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 in print!

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

  3. #3
    Sencha User
    Join Date
    Nov 2013
    Posts
    2
    Vote Rating
    0
      0  

    Default Change your beforeedit funciton like that

    beforeedit: function(editor, e){

    e.record.set('email' , '3');

    }

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
  •