Quantcast
Viewing all articles
Browse latest Browse all 8068

Alloy.createCollection inside js file

hello,

i have following codes:

books.js

var my_books  = Alloy.Collections.my_books.fetch();
books.xml
<Alloy>
    <ScrollableView dataCollection="my_books" disableBounce="true">
        <Require src="book"   />
    </ScrollableView>
</Alloy>
above shows all books one by one on sliding left right. now, inside require's book.xml (showing one book at a time), although book.xml is a really long code with book details i'm just showing the problem code only.

book.xml

...
<View id="book_reviews" dataCollection="my_book_reviews">
          <Require src="bookReviews"></Require>
</View>
...
book.js
var my_book_reviews  = Alloy.Collections.my_book_reviews.fetch();

i cannot do any createCollection and fetch inside book.js. i mean simulator keeps running but no result, it freezes.

is there any way that createcollection can be done in book.js?

i have tried using globals in index.js or alloy.js like this:

Alloy.Globals.fetch_my_book_reviews = function()
{
var my_book_reviews =   Alloy.createCollection('my_book_reviews');
return my_book_reviews.fetch();
}
and getting it in book.js like this:
var fetch_my_book_reviews = Alloy.Globals.fetch_my_book_reviews() ;
no results yet.

Viewing all articles
Browse latest Browse all 8068

Trending Articles



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