asp.net-core - 如何使用 ViewModel 值设置 KendoComboBox(jquery UI) 值?
问题描述
View(model) 从控制器 IActionResult 方法返回,但 Kendo 组合框选择的值不会像其他 UI 元素那样得到反映。
如何使用视图模型值设置组合框的选定值?
解决方案
您可以使用value
of设置它KendoComboBox
。例如:
$("#test").kendoComboBox({
dataTextField: "text",
dataValueField: "value",
dataSource: [
{ text: "", value: "1" },
{ text: "", value: "2" },
{ text: "", value: "3" },
],
filter: "contains",
suggest: true,
index: -1,
value: '@Model.yourValue'
});
推荐阅读
- excel - 将数据从源工作表复制到目标工作表的最后一行
- graphviz - 为什么此代码在 viz-js 站点中不起作用?
- javascript - 'whois' 响应“UnhandledPromiseRejectionWarning:TypeError:message.guild.members.get 不是函数”
- sql - 如何选择不与其他属性值共享的唯一域值?
- docker - 为什么从 Travis CI 推送后 Docker 映像没有出现在 Docker Hub 上
- sql - 如何将值从一个数据帧传递到另一个数据帧?
- python - 在同一绘图上绘制匀称的线串和匀称的地理点坐标
- glsl - GLSL 精明着色器
- android - 如何解决:错误:处理清单失败
- python - QProcess PyQt5 TypeError