You found a bug! We've classified it as EXTJS-8248 . 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
    Oct 2012
    Posts
    2
    Vote Rating
    0
    pompapathi.v.gadad is on a distinguished road

      0  

    Default [4.1.3] Tree store triggers 'update' event twice

    [4.1.3] Tree store triggers 'update' event twice


    Tree store triggers update event only once in 4.1.1a but in 4.1.3 it triggers twice. Is it expected behavior?

    Attached zip file containing the JavaScript.

    Run the html (modify the src and href in html to point to 4.1.3) which loads the treegrid.js. Click on any tree node to edit it. Modify the contents and press enter. While we were expecting only one alert with 'Updated' message we received two.

    Code:
    var store = Ext.create('Ext.data.TreeStore', {
        fields : ['name','user'],
        listeners : {
            update : function(store, record, operation, modifiedFieldNames, eOpts){
                        console.log('Updated')
                        }
                    },
        root: {
            expanded: true,
            children: [
                { name: "detention", leaf: true ,user : 'a'},
                { name: "homework", expanded: true,user : 'b', children: [
                    { name: "book report", leaf: true,user : 'c' },
                    { name: "alegrbra", leaf: true,user : 'd'}
                ] },
                { name: "buy lottery tickets", leaf: true,user : 'e' }
            ]
        }
    });
    
    Ext.create('Ext.tree.Panel', {
        title: 'Simple Tree',
        width: 200,
        height: 150,
        plugins : [ Ext.create('Ext.grid.plugin.CellEditing', {
                clicksToEdit: 1
            })],
        columns : [{
                xtype: 'treecolumn', //this is so we know which column will show the tree
                text: 'Task',
                flex: 2,
                sortable: true,
                editor : 'textfield',
                dataIndex: 'name'
            },{
                text: 'Assigned To',
                flex: 1,
                dataIndex: 'user',
                sortable: true
            }],
        store: store,
        rootVisible: false,
        renderTo: Ext.getBody()
    });
    Can you please help fixing this issue?
    Thanks,
    Pompa
    Attached Files

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Without using cell editing, you could use this test case to reproduce same behavior as cell editing plugin is only meant for grids:

    Code:
    Even though the cell editor is technically for the grid, so I created the test case below that simplifies it a little.
    
    Thanks for the report! I have opened a bug in our bug tracker.
    
    
    Code:
    var store = Ext.create('Ext.data.TreeStore', {
        fields : ['name','user'],
        listeners : {
            update : function(store, record, operation, modifiedFieldNames, eOpts){
                        console.log('Updated')
                        }
                    },
        root: {
            expanded: true,
            children: [
                { name: "detention", leaf: true ,user : 'a'},
                { name: "homework", expanded: true,user : 'b', children: [
                    { name: "book report", leaf: true,user : 'c' },
                    { name: "alegrbra", leaf: true,user : 'd'}
                ] },
                { name: "buy lottery tickets", leaf: true,user : 'e' }
            ]
        }
    });
    
    Ext.create('Ext.tree.Panel', {
        title: 'Simple Tree',
        width: 200,
        height: 150,
        columns : [{
                xtype: 'treecolumn', //this is so we know which column will show the tree
                text: 'Task',
                flex: 2,
                sortable: true,
                editor : 'textfield',
                dataIndex: 'name'
            },{
                text: 'Assigned To',
                flex: 1,
                dataIndex: 'user',
                sortable: true
            }],
        store: store,
        rootVisible: false,
        renderTo: Ext.getBody(),
        listeners : {
            itemclick : function(view, record) {
                record.set('name', record.get('name') + 1);
            }
        }
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 Premium Member
    Join Date
    Oct 2012
    Posts
    2
    Vote Rating
    0
    pompapathi.v.gadad is on a distinguished road

      0  

    Default


    Thanks for looking into this bug.
    I will be waiting for the fix.
    Thanks,
    Pompa

Thread Participants: 1