In my index.xml I have a line <Require src="court_list_view" /> Which uses template:
<Alloy> <ListView id="courtListView" defaultItemTemplate="template1" onItemclick="clickCourtListItem"> <Templates> <ItemTemplate name="template1" height="50"> <Label bindId="name" /> </ItemTemplate> </Templates>
<ListSection id="courtList" dataCollection="court"> <ListItem template="{template}" id:text="{id}" name:text="{name}" description:text="{description}" /> </ListSection>
</ListView>
</Alloy>
I'm rendering index.xml only if user is logged in (otherwise render login.xml), but anyway that list is trying to rendered and I'm getting error:
[ERROR] TiExceptionHandler: (main) [1578,1578] ----- Titanium Javascript Runtime Error ----- [ERROR] TiExceptionHandler: (main) [0,1578] - In alloy/controllers/court_list_view.js:1,69 [ERROR] TiExceptionHandler: (main) [0,1578] - Message: Uncaught ReferenceError: court is not defined [ERROR] TiExceptionHandler: (main) [0,1578] - Source: .createListSection({id:"courtList"});var u=Alloy.Collections.court||court;u.on
[ERROR] V8Exception: Exception occurred at alloy/controllers/court_list_view.js:1: Uncaught ReferenceError: court is not defined
This line in alloy.js solves the problem:
var courts = Alloy.Collections.court = Alloy.createCollection('court');
I assume that it just created empty collection ?
but I'd like to make sure if my approach is correct.