-
Notifications
You must be signed in to change notification settings - Fork 129
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
How to filter in GridView on parent? #115
Comments
@gvanto - did you have any luck with extending this to search on parent in GridView? |
Just CC'ing @cebe, maybe he has an idea. |
@cebe, any thoughts? |
Can you provide more context and semantics?
|
Hi @cebe, I want to be able to filter gridview on category and parent category. I can do it on category since it is based on the name, but can't seem to find a way to filter on parent category name. |
so what is llisted in your gridview? categories or items that are categorized (i.e. belong to a category)? |
Nope not looked into this for a while now. I am just listing a 'parent' column (but it's not yet filterable). With filtering things in general on GridView, I have found that you need a pretty customized ActiveQuery in your backend/{Model}/Search class, so guessing a pretty complex AQ will be required here (not had time to look into building it though! ) |
@cebe In the gridview right now I just have the category and then I get the parent with $model->parents(1) in a second column. |
@cebe do you have anything you can offer on this? |
I'm trying to filter on 'parent' of my (nested set) Category class, according to this:
http://www.yiiframework.com/wiki/621/filter-sort-by-calculated-related-fields-in-gridview-yii-2-0
But it's not working I suspect because the self-join query which would normally work on a activerecord row with 'parent_id' doesn't apply here (for nested sets).
Any ideas how to get filtering by a parent working?
Help much appreciated
Thanks
The text was updated successfully, but these errors were encountered: