I have a Kendo Grid where one of the columns contains an array of strings. I would like to use filtering on this column, but it would need to pull the distinct values of the array for each row.
I'm looking for the best approach to achieve my desired result.
i have created the following example where i would want to be able to filter on the classes column
https://dojo.telerik.com/@slberry75/utiXaXaW/10
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2023.2.829/js/angular.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2023.2.829/js/jszip.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2023.2.829/js/kendo.all.min.js"></script>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/themes/6.7.0/default/default-ocean-blue.css">
</head>
<div id="studentList"></div>
<script>
$(document).ready(function () {
var dataSource = new kendo.data.DataSource({
data: [
{id: 1, name: 'Harry Potter', classes: ['Arithmancy', 'Potions', 'Divination'], house: 'Gryffindor'}
, {id: 2, name: 'Blaise Zabini', classes: ['Herbology', 'History of Magic', 'Transfiguration'], house: 'Slytherin'}
, {id: 3, name: 'Dennis Creevy', classes: ['Charms', 'Potions', 'History of Magic'], house: 'Hufflepuff'}
, {id: 4, name: 'Luna Lovegood', classes: ['Divination', 'Charms'], house: 'Ravenclaw'}
]
});
$('#studentList').kendoGrid({
columns: [
{ field: 'name', title: 'Student Name' },
{ field: 'classes', title: 'Enrolled Classes', template: function(row) {
return row.classes.join('<br />')
}},
{ field: 'house', title: 'House Affiliation' }
],
dataSource: dataSource,
filterable: { mode: "row"}
});
})
</script>
</html>