Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

feat(groupBy): Define group by expression in repeat #1715

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

user378230
Copy link
Contributor

Changes the method for defining group by to simplify the codebase,
improve performance and better support changes going forward.

BREAKING CHANGE:

Removes support for group-by and group-filter attributes. Instead you
should now use an ng-repeat like syntax: ... group by x | ...

For example:

<ui-select-choices group-by="'country'" group-filter="['USA']"
  repeat="person in ctrl.people">

Now becomes:

<ui-select-choices
  repeat="person in ctrl.people group by person.country | filter:{name: 'USA'}">

Note that in order support filter groups based on an array with more
than one value (eg.group-filter="['A', 'B'...]") you will need to
use the new uisGroupFilter filter.

Example:

<ui-select-choices
  repeat="person in ctrl.people group by person.country | uisGroupFilter:['USA','Canada']">

Changes the method for defining group by to simplify the codebase,
improve performance and better support changes going forward.

BREAKING CHANGE:

Removes support for group-by and group-filter attributes. Instead you
should now use an `ng-repeat` *like* syntax: `... group by x | ...`

For example:
```
<ui-select-choices group-by="'country'" group-filter="['USA']"
  repeat="person in ctrl.people">
```
Now becomes:
```
<ui-select-choices
  repeat="person in ctrl.people group by person.country | filter:{name: 'USA'}">
```
Note that in order support filter groups based on an array with more
than one value (eg.`group-filter="['A', 'B'...]"`) you will need to
use the new `uisGroupFilter` filter.

Example:
```
<ui-select-choices
  repeat="person in ctrl.people group by person.country | uisGroupFilter:['USA','Canada']">
```
@aaronroberson
Copy link
Contributor

@user378230 This is exactly the direction I would like the project to go in. I'd like to discourage contributors from trying to add an endless amount of new attributes/options to support every conceivable use-case. Instead, a good use of filters and config objects like you've done here is in the spirit of this project, makes the code base more easily maintainable and configuration and use of the component much, much more sane!

@user378230 user378230 modified the milestones: v0.19.0, v0.20 Aug 15, 2016
@Jefiozie Jefiozie self-assigned this Jun 7, 2017
@Jefiozie Jefiozie removed their assignment Aug 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants