Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADD sorting in views by nested (related) fields ? #1185

Closed
mcd-php opened this issue Nov 12, 2013 · 1 comment · Fixed by #3061
Closed

ADD sorting in views by nested (related) fields ? #1185

mcd-php opened this issue Nov 12, 2013 · 1 comment · Fixed by #3061

Comments

@mcd-php
Copy link
Contributor

mcd-php commented Nov 12, 2013

For ArrayDataProvider, i already did this by overriding ArrayHelper::getValue to make it recursive and trivially overriding ArrayDataProvider::sortModels to use it ( hey, dependency injection, where you are ? )

For ActiveDataProvider, this will imply joins and extraction of join criterias from relations. But why not ?

P.S. In nested relations, dot is used as separator. However, in sort it doesn't get through, so i was forced to use -> as separator. Where is the dot being rejected and how to fix it ?

\yii\data\Sort::$separators should be changed to anything not related to class-field separation in any reasonable programming language, maybe ['~','-'] ? Separate issue ?

P.S.2 Do you need \app\data\LazyRelationsArrayDataProvider i just created for populating relations only on models to be shown ?

@cebe
Copy link
Member

cebe commented Nov 12, 2013

related to #802

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants