1. #1
    Sencha User
    Join Date
    Aug 2011
    Location
    Mumbai, India
    Posts
    119
    Answers
    11
    Vote Rating
    4
    Sasha172 is on a distinguished road

      0  

    Default Answered: Accessing ChildNode data in Nested List

    Answered: Accessing ChildNode data in Nested List


    Hi,

    I have a nested list component that is structured as follows :

    Code:
    {
        "items":[
                    {
                      "text": "Parent 1",
                      "leaf": false,
                      "items": [
                        {
                          "text": "Child 1",
                          "leaf" : true
                         },
                        {
                          "text": "Child 2",
                          "leaf" : true
                         },
                        {
                          "text": "Child 3",
                          "leaf" : true
                         },
    
                        ]
                       },
                    {
                      "text": "Parent 2",
                      "leaf": false,
                      "items": [
                        {
                          "text": "Child 1",
                          "leaf" : true
                         },
                        {
                          "text": "Child 2",
                          "leaf" : true
                         },
                        {
                          "text": "Child 3",
                          "leaf" : true
                         },
    
                        ]
                       } ] }
    As of now Im using the Ext.Nested list component to navigate thru the list as so : Parent1>Child1>detailCard etc

    However, I want to add a functionality such that : On clicking the Parent1 element in the list an alert should display how many Child objects it has in its items array.

    How do I go about that ?

    Thanks in advance
    Sasha

  2. This looks like a Sencha Touch question to me. This forum is for ExtJS 4. You may have more luck getting an answer in the Sencha Touch forum.

  3. #2
    Sencha User
    Join Date
    Aug 2011
    Location
    Mumbai, India
    Posts
    119
    Answers
    11
    Vote Rating
    4
    Sasha172 is on a distinguished road

      0  

    Default


    I should probably add that this is my store :

    Code:
    bus_store = new Ext.data.TreeStore({    model: 'ListItem',
        //root: data,
        proxy: {
            type: 'ajax',
            url: 'data/routes.json',
            reader: {
                type: 'tree',
                root: 'items'
            }
        }
    });
    And this is my NestedList

    Code:
    ..........
    
    BusView = Ext.extend(Ext.NestedList, {
          
          id: 'nestedList',
          title: 'Bus View',
          iconMask: true, 
          ui: 'plain',
          iconCls: 'locate',
          fullscreen: true,
          store: bus_store,
          displayField: 'text', 
    ...........

  4. #3
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,606
    Answers
    543
    Vote Rating
    326
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    This looks like a Sencha Touch question to me. This forum is for ExtJS 4. You may have more luck getting an answer in the Sencha Touch forum.

  5. #4
    Sencha User
    Join Date
    Aug 2011
    Location
    Mumbai, India
    Posts
    119
    Answers
    11
    Vote Rating
    4
    Sasha172 is on a distinguished road

      0  

    Default


    Right... Sorry thats my mistake.... I'll go repost this in the Sencha Touch forum.

    :P Sorry for the hassel

Thread Participants: 1

Tags for this Thread