Hello,
I have a column in my Grid with a custom filter which has pre-populated values in a dropdown. When user opens the page I want the default value to be set to a value that I pass from the Controller in ViewData. I'm able to set the grid filtered to a value on page load but the dropdown in the filter does not have the value selected.
Grid has the below column
columns.Bound(c => c.DealYear).Filterable(filterable => filterable.UI("yearFilter")).Width(70);
with the below options set
.Filterable(filterable => filterable
.Extra(false)
.Operators(operators => operators
.ForString(str => str.Clear()
.StartsWith("Starts with")
.IsEqualTo("Is equal to")
.IsNotEqualTo("Is not equal to")
))
)
And on page load I filter the grid with a value passed from Controller - This works fine.
.Filter(f =>f.Add(p => p.DealYear).Equals(ViewData["DealYear"]))
But in my javascript, how do I set the value to the Filter Dropdown?
function yearFilter(element) {
element.kendoDropDownList({
dataSource: {
transport: {
read: "@Url.Action("FilterMenuCustomization_DealYear")"
}
},
optionLabel: "--Select Year--"
});
}
The page loads with a predefined filter but the dropdown in the Filter shows 'Select Year'.
Thanks!