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

Binding Collection and Model to create detailed view

$
0
0

I'm starting with collections and models and I have a doubt. For example: View:

<Alloy>
    <Collection src="book" />
    <Window class="container">
        <TableView dataCollection="book" onClick="rowClick">
            <!-- Also can use Require -->
            <TableViewRow model="{id}" title="{title}" />
        </TableView>
    </Window>
</Alloy>
controller:
var book = Alloy.Collections.book;
book.fetch();
function rowClick(e){
 
    Alloy.Globals.navWin.openWindow(Alloy.createController('detailed', {data: book.get(e.rowData.model)}).getView(), {animated:false});
 
}
This code read a collection and list the multiple books in it, now I want if the user tap a row it will open a detailed view. But I am with problems to do it.

View:

<Alloy>
    <Model src="book" />
    <Window title="DETAILS" >
            <Label  text="{title}" ></Label>
        <Label  text="{author}" ></Label>
    </Window>
</Alloy>
controller:
var args = arguments[0] || {};
 
Alloy.Models.book.set(args.data.attributes);
I think this should have a easy way to implement but I need a little help.

Viewing all articles
Browse latest Browse all 8068

Trending Articles



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