I have a model called discussions, that I'm trying to sort by ID. I'm trying to display this sorted list of discussions in 2 places in my app, firstly at '/discussions' where the list sorts as I would expect, and secondly as a module on another page, '/syndicates/0/activity', where the list sorting does not work.
I'm defining the sort in my DiscussionsController
App.DiscussionsController = Ember.ArrayController.extend
sortProperties: ['id'],
sortAscending: true
isThisControllerBeingCalled: true
which should be called by default at '/discussions'. Here's the route:
App.DiscussionsRoute = Em.Route.extend
model: ->
@store.find 'discussion'
renderTemplate: ->
@render 'discussions',
into: 'application',
outlet: 'full'
for the discussions module at '/syndicates/0/activity' I'm pulling in the discussions via setupController with a controllerFor:
App.SyndicatesRoute = Em.Route.extend(
controllerName: 'discussions'
model: ->
@store.find 'syndicate'
renderTemplate: ->
@render 'syndicates',
into: 'application',
outlet: 'syndicates'
@render 'discussion_module',
into: 'application',
outlet: 'left',
controller: 'discussions'
setupController: (controller, model) ->
@controllerFor('discussions').set('discussions_for_module', @store.find 'discussion')
)
For '/syndicates/0/activity' the discussions remain unsorted. I tried to confirm that the discussions controller was being called sucessfully by setting a property in the controller, which I could see in both places.
Any idea why the discussions are not being sorted?
Aucun commentaire:
Enregistrer un commentaire