Skip to content

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

Open
@Cyc9

Description

@Cyc9

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! 👍

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions