kendo-ui – 如何从窗口更新Kendo Grid行
设置:
> ASP MVC项目 障碍: 如何使用新模型(来自窗口/窗体javascript)更新Grid的行(dataItem?).我无法获得目标dataItem的句柄. Select()在此处不适用,因为未选中该行.相反,自定义按钮事件打开模态网格窗口,其中包含用于更新,关闭等的字段和命令. 我可以使用原生的网格编辑,但我想要完成的是一种完全自定义弹出窗口的方法,显示可用于呈现CRUD操作的局部视图. 顺便说一句:这个的基本原理是优化网格行中的空间,通常使用不必要的编辑和删除按钮来消耗空间,使用Kendo本机控件属性.在我的案例中,我觉得这更好地呈现在一个单独的细节视图中,就像模型网格窗口一样. 同样,不使用Select(),我无法理解如何在Window / form JavaScript中获取调用它的Grid行的句柄,以便用新模型数据更新行. 谢谢你的时间.
使用你的方法你正在做双重请求所以我的建议:
在编辑时打开一个通过MVVM绑定到行的窗口: function edit(e) { //get the row which belongs to clicked edit button var item = this.dataItem($(e.currentTarget).closest("tr")); //bind the window to the item via mvvm http://docs.telerik.com/kendo-ui/framework/mvvm/overview kendo.bind($("#window"),item); } 该窗口包含一个编辑器模板(Shared / EditorTemplates / Client.cshtml): @(Html.Kendo().Window().Name("window") .Title("Client Details") .Visible(false) .Modal(true) .Draggable(true) .Width(400) .Content(@<text> @Html.Partial("EditorTemplates/Client",new Product()) </text>)) //Put in every element in the window data-bind="value:INPUT NAME" //<input name="price" /> become <input name="price" data-bind="value: price" /> $("#window [name]").each(function () { var name = $(this).attr("name") $(this).attr("data-bind","value:" + name ); }); 编辑器模板: @model Product @Html.TextBoxFor(m => m.Name) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- 当我在Windows上使用脚本名称运行Python脚本时,不能重定向输
- windows – _EPROCESS对象和_KPROCESS对象有什么区别
- windows-8 – 增加Win8热角的大小?
- windows – GPO安装 – 区分64位和32位系统
- windows-server-2003 – 学习使用Server 2003(或可能是2008
- windows-server-2008 – Powershell 2.0 Windows Server 20
- wcf – 为我配置“使用端点配置服务”演示失败(Microsoft /
- Win10 开启 Hyper-V 安装 CentOS 7 minimal
- .net – 如何在Windows 2016 RTM ADFS上为富客户端或Web应用
- winapi – Win32 API在当前的Windows版本中仍然是“原生的”