Ember GroupableMixin by using groupProperty


#1

I am trying to implement GroupableMixin (https://github.com/ahawkins/ember.js/blob/groupable-mixin/packages/ember-runtime/lib/mixins/groupable.js) on EmberJS but I have trouble using it.

I want to specify a groupProperty in my ArrayController (just like how we have sortProperties) and I want my groupings to be calculated based on that property.


I did try http://emberjs.jsbin.com/cawaq/3/edit and this is what I got:

App.UsersIndexController = Ember.ArrayController.extend({
  sortProperties: ['created_at'],
  groupProperty: 'role',
  groupedContent: groupBy('role'), //How do it reference groupProperty in groupBy?
  //How can groupedContent be updated whenever groupProperty is changed?
});

I have seen other examples but still cannot quite figure out how to make a ‘dynamic on the fly’ grouping work. Thanks!