I have a filter on a datasource which in return updates a grid. The following are the code to filter and its' template handler.
The problem with this is that, I can load the categories at first when I'm creating the filters. But when I save and reload the filter from local storage, the category dropdown does not load. Please help me with this. It loads up only on a fresh filter.
Thanks in advance.
@(Html.Kendo().Filter<Lovely>()
.Name("OrgFilter")
.ApplyButton(true)
.ExpressionPreview(true)
.DataSource("DataSource")
.Fields(f =>
{
f.Add(p=>p.OrgName).Label("Organization");
f.Add(p=>p.CategoryId).Label("Category").EditorTemplateHandler("CategoryDropdown");
f.Add(p=>p.AsAtDate).Label("As At Date");
}))
<script>
function CategoryDropdown(container, options) {
$('<input data-bind="value: value" name="' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList({
dataTextField: "CategoryId",
dataValueField: "CategoryId",
dataSource: @Json.Serialize(ViewData["Catogories"])
});
}
</script>