Javascript 剑道UI多选绑定一个列表值以更改另一个多选列表
好的,我试图从剑道ui多选列表中获取值,然后根据MVC控制器发回的返回内容更改secound列表中的数组 这是post-back,它返回一个Json对象Javascript 剑道UI多选绑定一个列表值以更改另一个多选列表,javascript,jquery,asp.net-mvc,asp.net-ajax,Javascript,Jquery,Asp.net Mvc,Asp.net Ajax,好的,我试图从剑道ui多选列表中获取值,然后根据MVC控制器发回的返回内容更改secound列表中的数组 这是post-back,它返回一个Json对象 [HttpPost] public ActionResult findProfileSettings(string selectedID) { var profiles_msl = obtainProfilesMethod(selectedID); ViewB
[HttpPost]
public ActionResult findProfileSettings(string selectedID)
{
var profiles_msl = obtainProfilesMethod(selectedID);
ViewBag.Profiles_msl = new List<Profiles>(profiles_msl);
var result = new List<Profiles>(profiles_msl);
return Json(result);
}
这是一个需要改变的问题
@(Html.Kendo().MultiSelect()
.Placeholder("Select Profiles")
.Name("Profiles")
.Value(new[] { new { } })
.HtmlAttributes(new
{
id = "ID",
data_bind = "options: Profiles_msl, optionsText: 'profiles', optionsValue: 'ID'"
})
)
我认为问题在于我如何构建multi-select
任何帮助,谢谢剑道UI multiselect没有“层叠自”元素,因此当前无法使用。我认为您应该在第二个
multiselect
上使用过滤器。在第一个MultiSelect
上为OnSelect添加一个事件,并在第二个MultiSelect上触发刷新,同时发送第一个的值。这样你就不需要重新绑定了。@AndreiV ok听起来像是一个解决方案,你有例子吗?如果是这样的话,请发布一个答案,我现在没有。看看这个。这是相似的。
@(Html.Kendo().MultiSelect()
.Placeholder("Select ")
.MaxSelectedItems(1)
.Name("list")
.Value(new[] { new { } })
.HtmlAttributes(new
{
id = "MSL",
data_bind = " options: list, optionsText: 'ID', optionsValue: 'cid'"
})
.Events(e =>
{
e.Change("onChange");
})
)
@(Html.Kendo().MultiSelect()
.Placeholder("Select Profiles")
.Name("Profiles")
.Value(new[] { new { } })
.HtmlAttributes(new
{
id = "ID",
data_bind = "options: Profiles_msl, optionsText: 'profiles', optionsValue: 'ID'"
})
)