Results 1 to 4 of 4

Thread: TreeStore binded to NestedList within Controller?

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    22
    Vote Rating
    1
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Vote Rating
    1272
      0  

    Default

    I'm not sure... I cannot read your code. Can you format your code so that it's legible?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    22
    Vote Rating
    1
      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
      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.

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
  •