【发布时间】:2021-06-02 05:03:14
【问题描述】:
我有一个 MVC Web 应用程序,在我的一个视图中我有一个 Kendo UI 网格:
@(Html.Kendo().Grid<Custodias.Models.ProjectMessageRecipientsModel>()
.Name("grid")
.Columns(columns =>
{
columns.ForeignKey(p => p.ProjectID_FK, (System.Collections.IEnumerable)ViewBag.ProjectList, "Value", "Text").Title("Project").Width(150).Filterable(filterable => filterable.Cell(e => e.Operator("eq").SuggestionOperator(FilterType.Contains).ShowOperators(false))); ;
columns.ForeignKey(p => p.ServiceUserID_FK, (System.Collections.IEnumerable)ViewBag.ServiceUserList, "Value", "Text").Title("Service User").Width(150).Filterable(filterable => filterable.Cell(e => e.Operator("eq").SuggestionOperator(FilterType.Contains).ShowOperators(false)));
columns.ForeignKey(p => p.ProcessKeyID_FK, (System.Collections.IEnumerable)ViewBag.ProcessKeyList, "Value", "Text").Title("Process Key").Width(150).Filterable(false);
columns.ForeignKey(p => p.ContactID_FK, (System.Collections.IEnumerable)ViewBag.ContactList, "Value", "Text").Title("HideContact").Width(150).Filterable(false);
columns.Bound(p => p.ContactName).Title("Contact").Width(200).Filterable(false).Hidden();
columns.Command(command => { command.Edit(); }).Width(90);
columns.Command(command => { command.Destroy(); }).Width(90);
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.PopUp).Window(w => w.Title("Edit Project Message Recipients").Width(500))).Events(e => e.Edit("onPopOpen"))
.Pageable()
.Resizable(resize => resize.Columns(true))
.Sortable()
.Scrollable()
.Filterable(ftb => ftb
.Mode(GridFilterMode.Row)
.Extra(false)
)
.HtmlAttributes(new { style = "height:550px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Events(events =>
{
events.RequestEnd("onRequestEnd");
})
.Model(model => model.Id(p => p.ProjectMessageRecipientID_PK))
.Create(update => update.Action("CreateProjectMessageRecipients", "ProjectMessageRecipients"))
.Read(read => read.Action("BindProjectMessageRecipientsModel", "ProjectMessageRecipients"))
.Update(update => update.Action("UpdateProjectMessageRecipients", "ProjectMessageRecipients"))
.Destroy(update => update.Action("DeleteProjectMessageRecipients", "ProjectMessageRecipients"))
)
)
我希望能够做的是,当有人在第一列(“项目”)中使用搜索过滤器然后去添加新记录时,我希望该搜索过滤器中的值自动填写在“添加新记录”弹出窗口的下拉列表中:
这可能吗?
【问题讨论】:
标签: javascript jquery asp.net-mvc kendo-ui kendo-grid