Results 1 to 3 of 3

Thread: How to get TreeStore or TreePanel when an itemAppend event occurs ?

  1. #1
    Sencha User
    Join Date
    May 2010
    Location
    FRANCE
    Posts
    10
    Answers
    1
    Vote Rating
    1
      0  

    Default Answered: How to get TreeStore or TreePanel when an itemAppend event occurs ?

    Hi,

    Using ExtJS 4.1, how to get TreeStore or TreePanel when an itemAppend event occurs ?
    I don't see any reference to the TreeStore or the Panel during the event nor the nodes attributes.

    See below the code that doesn't work.

    Note there is not only one ContainersTree. Multiple ones can be created, each one is displayed in a separate tab of a TabPanel.

    Regards,

    Guillaume

    VIEW :
    Code:
    Ext.define('Link.view.module.ContainersTree', {
            extend: 'Ext.tree.Panel',
            alias: 'widget.ModuleContainersTree',
    
            initComponent: function() {
                this.store = Ext.create('Ext.data.TreeStore', {
                        model: 'Link.model.Container',
                ...
                }
                this.relayEvents(this.store, ['load', 'append'], 'store');
                this.callParent(arguments);
            },
    ...
    });
    CONTROLLER :
    Code:
    Ext.define('Link.controller.module.Edit', {
        extend: 'Ext.app.Controller',
    
        views: [ 'module.ContainersTree'],
    
        models: ['Container'],
    
        init: function() {
            this.control({
                    'ModuleContainersTree': {
                        itemappend: function(parentNode, childNode) {
                            // HOW TO GET THE ModuleContainersTree PANEL HERE ?
                        },
                        storeappend: function(parentNode, childNode) {
                            // HOW TO GET THE TREESTORE HERE ?
                        }
                    }
            });
        ...
    });

  2. I got it. It works.

    The node, which is also an Ext.data.Model, had a "store" attribute.

    CONTROLLER :
    Code:
    ...
    
    this.control({
        'ModuleContainersTree': {
            storeappend: function(parentNode, childNode) {
                var nodeStore = parentNode.store; // It is an Ext.data.NodeStore object
                var treeStore = nodeStore.treeStore;  // Here it is the tree store
                ...
            }
        }
    });
    ...
    Hope it can help.

  3. #2
    Sencha User
    Join Date
    May 2010
    Location
    FRANCE
    Posts
    10
    Answers
    1
    Vote Rating
    1
      0  

    Default

    I got it. It works.

    The node, which is also an Ext.data.Model, had a "store" attribute.

    CONTROLLER :
    Code:
    ...
    
    this.control({
        'ModuleContainersTree': {
            storeappend: function(parentNode, childNode) {
                var nodeStore = parentNode.store; // It is an Ext.data.NodeStore object
                var treeStore = nodeStore.treeStore;  // Here it is the tree store
                ...
            }
        }
    });
    ...
    Hope it can help.

  4. #3
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,389
    Answers
    716
    Vote Rating
    498
      0  

    Default

    Thank you for providing the solution.

    Scott.

Posting Permissions

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