we have a field in which the source value is an array of objects, to edit it we use kendoMultiSelect, to show we just concat the values:
this.MultiSelectEmployeeClassesArrayToString = function (item) {
return item.EmployeeLicensingClasses
.map(function (employeeClass) { return employeeClass.Description; })
.join(', ');
},
is there a way to make filtering work as a contains for example & sort just the value we display (concatenating)?
Hi Aleksandr,
Generally speaking, the MultiSelect allows you to select values from a predefined list of choices. If the typed value does not exist in this list the user will not be able to use it as a value.
Here is an article on Filter Grid by Using the MultiSelect: https://docs.telerik.com/kendo-ui/knowledge-base/filter-grid-with-multi-select-widget
Also, below I am posting an article on how to Modify the Default Behavior of Filter Operators:
Hope this helps.
Regards,
Nikolay
Hello Nikolay,
the example you have provided not exactly what i was looking for, now trying to change the filter on the fly during grid filter event, does not work, could help figure out why
Hi Aleksandr,
Updating the e.filter expression will not update the internal filter logic. You can cancel the filter event with preventDefault() and filter the Grid with your custom logic by using the filter() method.
filter: function (e) { e.preventDefault() if (e.field === "ShipName" && e.filter) { var ecFilters = { logic: 'or', filters: [] }; var val = null; e.filter.filters.forEach(function (f) { if (f.field === "ShipName") { val = f.value; } }); console.log("val", val) e.filter.filters = e.filter.filters.filter(function (f) { return f.field !== "ShipName"; }); if (val) { ecFilters.filters.push({ field: 'ShipName', operator: 'contains', value: "Hanari Carnes" }) }; e.filter.filters.push(ecFilters) e.sender.dataSource.filter(ecFilters) } }
Regards,
Nikolay