1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    22
    Vote Rating
    1
    IainP is on a distinguished road

      0  

    Default TreeStore binded to NestedList within Controller?

    TreeStore binded to NestedList within Controller?


    Hi Guys,

    I've been learning the Touch framework for the past week now and I'm trying to wrap my head around the MVC pattern. I've read a lot of documentation but can't seem to find what I'm looking for. I have a treestore and I need it binding to a nestedlist. I am able to do this if I place the treestore and model within my view but I want them in their correct folders /store and /model and the logic placed in my controller. Here is my controller code:

    Code:
    Ext.define('AppName.controller.AppController', {           extend: 'Ext.app.Controller',           config: {                            stores: ['AppStore'],                                           refs: {                                nestedList: '#nestedList'                },                                control: {                   "#nestedList": {                    leafitemtap: 'onListItemTap'                   }                }            },                        launch: function() {                                // WHAT GOES HERE TO BIND STORE TO NESTED LIST            },                       onListItemTap: function(list, index, target, record, e) {                                                Ext.Viewport.setActiveItem( {                    xtype:'tabpanelview',                    activeItem: 4                    });                      }           });
    Any help is much appreciated. Thank guys.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,217
    Vote Rating
    859
    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


    I'm not sure... I cannot read your code. Can you format your code so that it's legible?
    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 User
    Join Date
    Oct 2012
    Posts
    22
    Vote Rating
    1
    IainP is on a distinguished road

      0  

    Default


    I'm not sure why was formatted the way it was... sorry.

    Ext.define('AppName.controller.AppController', {
    extend: 'Ext.app.Controller',
    config: {

    stores: ['AppStore'],

    refs: {
    nestedList: '#nestedList'
    },

    control: {
    "#nestedList": {
    leafitemtap: 'onListItemTap'
    }
    }
    },

    launch: function() {

    // WHAT GOES HERE TO BIND STORE TO NESTED LIST
    },

    onListItemTap: function(list, index, target, record, e) {

    Ext.Viewport.setActiveItem( {
    xtype:'tabpanelview',
    activeItem: 4
    });

    }

    });

  4. #4
    Sencha User
    Join Date
    Oct 2012
    Posts
    22
    Vote Rating
    1
    IainP is on a distinguished road

      0  

    Default


    I've added the following to my Controller...

    launch: function() {
    Ext.getStore('AppStore').load();
    }


    ... and in my view my Nested List looks like this ...


    items: [{
    title: 'Profiles',
    xtype: 'nestedlist',
    fullscreen: true,
    store: 'AppStore', ....


    There are no errors in my console however the Nested List does not appear. I must be missing something. I know there is nothing wrong with the Store itself because if I place the Store in the view the Nested List appears.

    On a side note how do I format my code on this forum. Wrapping it in PHP tags makes it look like my first post in this thread.

    Thanks guys.

Thread Participants: 1

Tags for this Thread