Refresh Ember-Data collection after query change
Well, not 100% emberish way, but what if I need to filter collection on
server using some query with no location change. I have the following
solution:
Twicl.GroupsIndexController = Ember.ArrayController.extend
query: '' //bound to a textfield
queryChanged: ( ->
clearTimeout(@delay)
@delay = setTimeout ( => @target.send('refresh') ), 500
).observes('query')
Twicl.GroupsIndexRoute = Ember.Route.extend
model: ->
@store.find 'group',
q: @controllerFor('groups.index').get('query') //Here is no
@controller yet, why? :( It's assigned in setup() as I see.
actions:
refresh: ->
@controller.set 'content', @model()
Is there more natural way to do so? I see query object on content, but
collection doesn't reflect any changes of it. Other ways how it could be
done?
No comments:
Post a Comment