ember-group-by
ember-group-by copied to clipboard
Add calculated properties to groups
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.
+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...
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...
Sure thing, I will add an example how we use it in our project and add an additional unit test for calculated properties.
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?