In my KendoUI grid I have a column with cell values like
- ABC, BCD, CDE
- BCD, QWE, ZXC
- ABC, ZXC, POI
- etc
I want this column to have filtering with multiple checkboxes so I put
filterable: { multi: true }
- ABC
- BCD
- CDE
- QWE
- ZXC
- POI
I guess I need to implement custom filtering for that. It's like I need to parse the cell content for comma separated values and put each of that value on a separate filter checkbox. Any advise how to do that?
5 Answers, 1 is accepted
0
Andrey
Top achievements
Rank 1
answered on 13 May 2016, 10:45 AM
So I can get an array of unique values like so:
How do I then apply this array to filter checkboxes? So that I have a separate checkbox for each value and it will work as "contains" filter.
var arrayValues = [], i;
var data = gridData.dataSource._data;
for(i = 0; i < data.length; i++){
var sep = data[i].productType.split(', ');
arrayValues = arrayValues.concat(sep);
}
arrayValues.sort();
for(i = arrayValues.length - 1; i > 0; i--) {
if(arrayValues[i] == arrayValues[i - 1]) {
arrayValues.splice(i, 1);
}
}
console.log(arrayValues);
How do I then apply this array to filter checkboxes? So that I have a separate checkbox for each value and it will work as "contains" filter.
0
Accepted
Hi Andrey,
You could set the dataSource as shown in the following example from our help article:
However, since the built-in filter expression will be with "equalTo", changing only the dataSource will not do the trick and you will have to customize the filter for the column and manually build the filter expression. You can take a look at the following HowTo article for reference:
Hope this helps.
Regards,
Konstantin Dikov
Telerik
You could set the dataSource as shown in the following example from our help article:
However, since the built-in filter expression will be with "equalTo", changing only the dataSource will not do the trick and you will have to customize the filter for the column and manually build the filter expression. You can take a look at the following HowTo article for reference:
Hope this helps.
Regards,
Konstantin Dikov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Andrey
Top achievements
Rank 1
answered on 16 May 2016, 04:01 PM
Thank you, Konstantin!
This was very helpful.
This was very helpful.
0
Andrey
Top achievements
Rank 1
answered on 16 May 2016, 04:35 PM
So I managed to make a custom filter with unique values parsed from comma separated values and it works fine. But when I try to export to Excel I still see those initial values like "ABC, BCD, CDE" etc.
Is it possible to apply the same filter to Excel?
Is it possible to apply the same filter to Excel?
0
Hello Andrey,
I have tested the example for custom checkbox-filter menu with export to Excel and the filtering is working correctly for the exported file as well:
Can you please create a dojo example that replicates the issue, so we can test it locally?
Regards,
Konstantin Dikov
Telerik
I have tested the example for custom checkbox-filter menu with export to Excel and the filtering is working correctly for the exported file as well:
Can you please create a dojo example that replicates the issue, so we can test it locally?
Regards,
Konstantin Dikov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!