Excel type filtering column for list of items

1 Answer 245 Views
Data Source Grid
Mihran
Top achievements
Rank 1
Mihran asked on 19 Oct 2021, 06:18 PM

I'm trying to do a excel type filtering for a list of items on the front end. I was able to do it for a text field using data.fieldName but how can this be done for a list of objects? Here is the syntax:

({
                field: "nationalProductId", title: "National Product", values: data.getCachedData(`api/nationalProducts/getDropDown/${sotSummary.region}`), width: 250, filterable: {
                    multi: true, itemTemplate: () => {
                       `<form><label style='padding-right: 8px'>#= data.nationalProductId|| data.all #</label><input type='checkbox' value='#= data.nationalProductId#'/></form>`;
                    }
                }
            }),

In the above nationalProductId is a text value pair list of objects with a count of 9. When executing the code, I get a list of 9 checkboxes that are all undefined. The value of each checkbox = undefined.  Is there a way to get the list of values in my filter?

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 22 Oct 2021, 03:49 PM

Hi,

We have a Knowledge base article Filter a Column with a DropDownList Editor When the Column Is Bound To a Complex Object. In such scenarios we should programmatically apply the filters on the filter event of the Grid. This approach also requires programmatic clearing of the filters for that column when the user clicks the Clear button. The following Dojo snippet shows how to use a ListView with checkboxes to apply filtering on the Category column.

Regards,
Dimitar
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Data Source Grid
Asked by
Mihran
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or