I have a situation where isLoaded on DS.RecordArray changes to true, but the content, length property for RecordArray is still empty, 0 at this time and only changes later.
Sample code (coffeescript):
@set('followRequests', App.FollowRequests.find())
...
whenDataLoads: (->
console.log @get('followRequests.isLoaded')
console.log @get('followRequests.length')
@set('content', @get('followRequests').toArray() )
).observes('followRequests.isLoaded')
The first log statement is true, and the second is 0, and the template that uses this data is empty. When I see the actual AJAX request, I see that the request returns an array of records. Both the length and contents of the RecordArray may change after some time, as shown on the browser console by doing the following:
App.Router.myController.get('followRequests').get('length') ---> 12
However, this code (below) fills the content in the template, but it works 12 times ...
whenDataLoads: (->
console.log @get('followRequests.isLoaded')
console.log @get('followRequests.length')
@set('content', @get('followRequests').toArray() )
).observes('followRequests.length')
What is the right way to find out when RecordArray is full ... ??
source
share