ember-group-by icon indicating copy to clipboard operation
ember-group-by copied to clipboard

Add calculated properties to groups

Open daanwissing opened this issue 9 years ago • 4 comments

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.

daanwissing avatar Apr 30 '15 11:04 daanwissing

+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 avatar May 28 '15 20:05 hlogmans

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...

hlogmans avatar May 28 '15 21:05 hlogmans

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

daanwissing avatar May 29 '15 07:05 daanwissing

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?

hlogmans avatar May 29 '15 18:05 hlogmans