Hi, I recently created a grid with a multiselect filter and noticed that the selected values are not showing if the user selects more than one item and then filters. I could reproduce the behaviour in a short dojo script which comes from the telerik examples.
Is there any reason for this behaviour or did I forget something that makes the filter control fail? If this is a bug, is there a workaround?
In the example, the field that contains the filter is "Name" (2nd column).
<!DOCTYPE html><html>
<head>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2023.1.117/styles/kendo.default-ocean-blue.min.css">
<script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2023.1.117/js/angular.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2023.1.117/js/jszip.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2023.1.117/js/kendo.all.min.js"></script>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js"></script>
<div id="grid"></div>
<script>
var data = [
{ id: 1, name: "Fred", key: 1, value: "Green" },
{ id: 2, name: "Jed", key: 11, value: "Jorgensen" },
{ id: 3, name: "Red", key: 2, value: "Blah" },
{ id: 4, name: "Ted", key: 23, value: "Bleh" },
{ id: 5, name: "Ed", key: 3, value: "Toast" },
{ id: 6, name: "Zed", key: 4, value: "Smith" },
{ id: 7, name: "Ed", key: 41, value: "Johnson" }
];
$(function() {
var names = _.sortBy(_.uniq(_.pluck(data, "name")), function(n) { return n; });
function createMultiSelect(element) {
element.kendoMultiSelect({
dataSource: names
});
}
var dataSource = new kendo.data.DataSource({
data: data,
schema: {
model: {
fields: {
id: { type: "number" },
name: { type: "string" },
key: { type: "number" },
value: { type: "string" }
}
}
}
});
var grid = $("#grid").kendoGrid({
dataSource: dataSource,
sortable: true,
filterable: true,
columns: [
{field: "id", title: "Id"},
{
field: "name",
title: "Name",
filterable: {
ui : createMultiSelect,
extra: false
}
},
{field: "key", title: "Key"},
{ field: "value", title: "Value"}
]
});
});
</script></body>
</html>