I have a grid with a custom filter on one column
@(Html.Kendo().Grid<Model>()
.Name("grid")
.Events(e => e.FilterMenuInit("FilterMenuInit"))
.Columns(columns =>
{
…
columns.Bound(e => e.DocumentType).Title("Title").Filterable(x => x.UI("SomeFunction")
.Extra(false)
.Operators(k => k
.ForString(str => str.Clear()
.IsEqualTo("Is equal to")
.IsNotEqualTo("Is not equal to")
))
);
columns.Bound(e => e.Something).Title("Title").Filterable(false);
columns.Bound(e => e.SomethingElse).Title("AnotherTitle").Width(50);
…
})
.Filterable()
.Sortable()
.Pageable(x =>
{
...
})
.DataSource(dataSource => dataSource
...
)
)
the dropdownllist of the filter has all the distinct values that are in the column
function SomeFunction (element) {
const distinctDocTypes = GetDistinctDocTypes();
element.kendoDropDownList({
dataSource: distinctDocTypes,
optionLabel: "Select Doc Type",
dataTextField: "Title",
dataValueField: "Title",
open: AdjustDropDownWidth
});
}
private getDistinctDocTypes() {
const data = $("#grid").data("kendoGrid").dataSource.data();
const docTypes = (a => {
var seen = {};
return a.filter(e => seen[e.DocumentType] ? false : (seen[e.DocumentType] = true)).map(e => ({
Title: e.DocumentType
}));
})(data);
return docTypes.sort((a, b) => a.Title.localeCompare(b.Title));
}
THis works fine.
The thing is, if there is a refresh of the page and the number of distinct values is greater, i just want to add, not take, it does not change in the dropdown.
How can I reflect that change? Is there a event I can capture or so?