Results 1 to 3 of 3

Thread: [4.1.3] Tree store triggers 'update' event twice

    Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha Premium Member
    Join Date
    Oct 2012
    Posts
    2
    Vote Rating
    0
      0  

    Default [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 Attached Files

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,422
    Vote Rating
    1271
      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 @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 Premium Member
    Join Date
    Oct 2012
    Posts
    2
    Vote Rating
    0
      0  

    Default

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

Posting Permissions

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