HeroicEric / ember-group-by

An Ember addon that adds a computed property macro for grouping objects by a given property.
MIT License
53 stars 17 forks source link

Add calculated properties to groups #3

Open daanwissing opened 9 years ago

daanwissing commented 9 years ago

I added some extra functionality to the groups. Now, when the groups are created, they can get some additional properties which can be get() and set() in a controller. Properties can be "basic" properties (string, number) or functions (e.g. getGroupSize()).

I also added a unit test for this. Unfortunately I also had to fix the existing unit tests, since deepEqual() did not work as expected anymore.

hlogmans commented 9 years ago

+1, just wanted to create a PR just for this, but you did the work already. I have to do some running totals on the groups...

hlogmans commented 9 years ago

Maybe the PR should include a small example in the README. And maybe an example with a function property. I can only get basic values to work, as soon as it is computed, I only get an empty object back... Maybe I am overlooking something trivial...

daanwissing commented 9 years ago

Sure thing, I will add an example how we use it in our project and add an additional unit test for calculated properties.

hlogmans commented 9 years ago

Superb! But I still got the problem that functions are not working as expected. In my templates the function is just not evaluated, but presented as 'function total() { return 2; }'... Probably nothing to do with your code, but maybe someone has a clue?