Skip to content

Issues filtering column based on a sub-object. #40

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

Open
Cyc9 opened this issue May 22, 2017 · 1 comment
Open

Issues filtering column based on a sub-object. #40

Cyc9 opened this issue May 22, 2017 · 1 comment
Assignees

Comments

@Cyc9
Copy link

Cyc9 commented May 22, 2017

My data is as follows
[ { name : 'Hard drive" , category: { id : xxxxxxxxxxxx name: 'Electronics' } , { name : 'Pen' , category: { id : yyyyyyyyyyyy name: 'Stationery' } .... ]

Am displaying the grid which works excellently. Now comes the filtering. I have an Input-select which populates the category names. I want to select say all items in category: 'Electronics'.

So I have

<select id="categoryFilter" class="form-control" ng-model="category" filter-by="category.name" filter-type="select" ng-change="filter()" ng-options="category.name as category.label for category in categoryFilterData track by category.name"></select>

This doesn't work. I checked in the dataGrid.js file, and the issue is with the way the data is filtered in filtersFactory

The way the filter is being applied is

return value && item[predicate] ? item[predicate] === value : true;

which translates to item['category.name'] and this does not work.

I know this is not stack overflow to ask you to help me in my code, and I have already worked past this by applying the filter in my select query to the REST Server. However, this would be a good enhancement, to be able to select based upon sub-documents.

Thanks for the great work! 👍

@AlexanderZhukCoherent
Copy link
Contributor

need to review #41

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

No branches or pull requests

3 participants