1. #1
    Sencha User
    Join Date
    Jul 2011
    Location
    Melbourne Australia
    Posts
    8
    Vote Rating
    0
    tdack is on a distinguished road

      0  

    Default Unanswered: DataView - useComponents and accessing associated stores & data

    Unanswered: DataView - useComponents and accessing associated stores & data


    My data is in the following format:

    Code:
    {
        "ProgramList":{
            "StartIndex":"0",
            "Count":"24",
            "TotalAvailable":"24",
            "AsOf":"2012-06-05T01:16:14Z",
            "Version":"0.25.20120408-1",
            "ProtoVer":"72",
            "Programs":[
                                        {
                                            "StartTime":"2012-06-05T01:36:00Z",
                                            "EndTime":"2012-06-05T02:00:00Z",
                                            "Title":"Babar",
                                            "SubTitle":"Tutu Badou\/Hidden Courtyard",
                                            "Description":"The iconic tales of Babar return.",
                                            "Channel":{
                                                "ChanId":"1022",
                                                "ChanNum":"22",
                                                "CallSign":"ABC2 \/ ABC4",
                                                "IconURL":"\/Guide\/GetChannelIcon?ChanId=1022",
                                                "ChannelName":"ABC2 \/ ABC4"
                                            },
                                            "Recording":{
                                                "Status":"-1",
                                                "Priority":"-1",
                                                "StartTs":"2012-06-05T01:33:00Z",
                                                "EndTs":"2012-06-05T02:07:00Z"
                                            }
                                        },
                                        {
                                            "StartTime":"2012-06-05T09:00:00Z",
                                            "EndTime":"2012-06-05T10:00:00Z",
                                            "Title":"Masterchef Australia",
                                            "SubTitle":"Tuesday - Week 5",
                                            "Description":"With the chance to compete in ...",
                                            "Channel":{
                                                "ChanId":"1010",
                                                "ChanNum":"10",
                                                "CallSign":"TEN Digital",
                                                "IconURL":"\/Guide\/GetChannelIcon?ChanId=1010",
                                                "ChannelName":"TEN Digital"
                                            },
                                            "Recording":{
                                                "Status":"-1",
                                                "Priority":"1",
                                                "StartTs":"2012-06-05T08:57:00Z",
                                                "EndTs":"2012-06-05T10:07:00Z"
                                            }
                                        }
                                     ]
    }
    I'm trying to display the information in a DataView with useComponents: true.

    I have defined a model and associated models for the store (and set rootProperty appropriately). This works well and the data is read in along with the associated data. I can display the individual fields for each record (eg: StartTime or Title), but I can't work out how to access or display the associated records (eg: Channel.CallSign or Recording.Status).

    With XTemplates I can loop over the children of a "field" in a record to display that information.

    How can I achieve similar with DataViews/DataItems and useComponents?
    Should I be trying to create a sub-DataView for the associated records to display information from them?
    If so, how do I define the dataMap to pass the store in the applyXXX method for the field?

    Example code & data: http://www.senchafiddle.com/#sZpSy

  2. #2
    Sencha User
    Join Date
    Mar 2012
    Posts
    4
    Answers
    1
    Vote Rating
    0
    kmc is on a distinguished road

      0  

    Default


    Unfortunately tdack, I have no idea. But if you figure out something, please let me know how. It seems quite unfortunate that you can't just setStore for a child component, like you can setHtml.

  3. #3
    Ext JS Premium Member canxss's Avatar
    Join Date
    Sep 2008
    Posts
    184
    Answers
    1
    Vote Rating
    3
    canxss is on a distinguished road

      0  

    Default


    Yes, I really want to know that too. It would be nice if there was such an example since this is one of those common real world cases: Master and details...

  4. #4
    Sencha User
    Join Date
    Aug 2011
    Location
    London
    Posts
    393
    Answers
    14
    Vote Rating
    16
    digeridoopoo will become famous soon enough

      0  

    Default


    I've never used the useComponents feature before I've never quite understood it...but I have accessed data similar to yours and applied it to a dataview. I made a YouTube video wall which grabs similar data. I mapped the data like yours in the model itself to more meaningful names e.g YouTube.hqdefault I mapped to largeimage model name.:-)

    Can post some code if it helps...