I need to create a filtering mechanism and I'm attempting to figure out the best way to do it. Yes, I have a post to the Filter forum... but I'm likely going to be told that it is more complex than what the users will want. So, I have a menu bound to a collection of user-defined Templates as shown. Each Template has multiple Items as bound to the children/sub-menu.
As the user selects options from this menu, I need to retain the Child Item's Id in order to build a Filter set that I can submit to a REST service. Because the menu will not provide feedback like your Filter control, I'll need to display the filter in a field that'll grow as they add criteria much like the "ExpressionPreview" on the Filter control.
Template:
public partial class SessionOptionTemplate{ public int Id { get; set; } [MaxLength(50)] public string Name { get; set; } [MaxLength(128)] public string Description { get; set; } public int Order { get; set; } public DateTime AddTimestamp { get; set; } = DateTime.UtcNow; public DateTime? DeactivateTimestamp { get; set; } public ICollection<SessionOptionItem> SessionOptionItems { get; set; } = new HashSet<SessionOptionItem>();}Item:
public partial class SessionOptionItem{ [Key] public int Id { get; set; } public int SessionOptionTemplateId { get; set; } [MaxLength(50)] public string Name { get; set; } [MaxLength(128)] public string Description { get; set; } public DateTime AddTimestamp { get; set; } = DateTime.UtcNow; public DateTime? DeactivateTimestamp { get; set; }}Menu:
@model IEnumerable<SessionOptionTemplate>@(Html.Kendo().Menu() .Name("Menu") .Scrollable(true) .BindTo(Model, mappings => { mappings.For<SessionOptionTemplate>(binding => binding .ItemDataBound((item, template) => { item.Text = template.Name; }) .Children(category => category.SessionOptionItems)); mappings.For<SessionOptionItem>(binding => binding .ItemDataBound((item, option) => { item.Text = option.Name; })); }))
