This is a migrated thread and some comments may be shown as answers.

DataSource filter function arguments

1 Answer 79 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Harper
Top achievements
Rank 1
Harper asked on 06 Mar 2018, 08:23 PM

I'm trying to write a custom filter function because the field I want to filter on is an object, rather than a primitive value, and the filter value I'm using is a primitive that I'm comparing to a field on the object (based on a selection in a DropDownList). Here's the code I'm using:

ds.filter({
                field: "Platform",
                operator: function (item, filterValue) {
                    return item.DisplayName == filterValue;
                },
                value: e.sender.dataItem(e.sender.select()).Platform.DisplayName
            });

 

However, the "item" argument is *not* an individual item from the datasource that needs to be filtered - it's an array/collection of some sort. What's the correct way to write this function so that I can correctly filter the datasource?

1 Answer, 1 is accepted

Sort by
0
Harper
Top achievements
Rank 1
answered on 06 Mar 2018, 08:34 PM
Please disregard this - I was overlooking a change I'd made that changed the structure of what "item" should be.
Tags
MultiSelect
Asked by
Harper
Top achievements
Rank 1
Answers by
Harper
Top achievements
Rank 1
Share this question
or