DataSource filter function arguments

2 posts, 0 answers
  1. Harper
    Harper avatar
    12 posts
    Member since:
    Oct 2013

    Posted 06 Mar 2018 Link to this post

    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?

  2. Harper
    Harper avatar
    12 posts
    Member since:
    Oct 2013

    Posted 06 Mar 2018 in reply to Harper Link to this post

    Please disregard this - I was overlooking a change I'd made that changed the structure of what "item" should be.
Back to Top