Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

How to bind nested data with TableView

$
0
0

I have data that looks like this:

[
    {
        gameName: "some rpg game",
        currentPlayers: 22,
        players: [
            {
                name: "john doe",
                teams: [
                    "team1", "team2"
                ],
                score: 15
            },
            {
                name: "john doe",
                teams: [
                    "team1", "team2"
                ],
                score: 15
            }
        ]
    },
    {
        gameName: "some fps game",
        currentPlayers: 222,
        players: [
            {
                name: "john doe2",
                teams: [
                    "team12", "team22"
                ],
                score: 152
            },
            {
                name: "john doe2",
                teams: [
                    "team12", "team22"
                ],
                score: 152
            }
        ]
    }
];
This is JSON returned from a webservice. I'd like to bind it to a TableView (or a ListView, or any other view that is doing what I want ;) ). I'd like to show it the same way it came to my app - so I need to divide my TableView into sections - sections need to have headers with two Labels - one for gameName, and the other for currentPlayers, and below header section should have rows (sometimes it will be one row, sometimes two, sometines one hundred). My problem is that I have no idea how to bind this kind of nested data...

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>