Search code examples
titaniumappceleratortitanium-mobilebackbone-viewstitanium-alloy

Data binding to nested views


I think this is best explained using an example. Say I want to display a list of movies with actors below each move. eg:

Movie A
 - Actor 1
 - Actor 2
Movie B
 - Actor 4
 - Actor 5 
 - etc.

JSON file looks like:

{   movies: [
        {   movie_name: "Movie A",
            actors: [
                { actor_name: "Actor 1" },
                { actor_name: "Actor 2" }
            ]
        },
        {   movie_name: "Movie B",
            actors: [
                { actor_name: "Actor 4" },
                { actor_name: "Actor 5" },
            ]
        }   
    ]
}

The view:

<TableView dataCollection="movies">
  <TableViewRow>
    <Label class="movie_heading" text="{movie_name}"></Label>

    **<Label dataCollection="actors.actor_name ???? ">**

  </TableViewRow>
</TableView>

I'm not sure how to go about binding the actors to the second level of the view. I'm looking for something like ng-repeat in angular but I can't seem to rebind actors.actor_name. Any help appreciated :)


Solution

  • Pretty sure you can't do this at the moment in Accelerator.