Kendo UI 网格 - 用于编辑和创建的不同模板 [英] Kendo UI grid - different templates for Edit and Create

查看:13
本文介绍了Kendo UI 网格 - 用于编辑和创建的不同模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用 Kendo UI 网格来显示一些记录.当用户点击编辑"时,要求我们有一列(比如文件名")显示为一个文本框.但是,当用户单击工具栏中的创建"按钮时,应将同一列替换为文件选择控件,该控件将允许用户从他的机器中选择文件.其他列保持不变.我已经尝试通过 Stack Overflow 和 Kendo UI Grid 论坛进行搜索,但无济于事.有没有办法实现这一目标?任何指针都会有很大帮助.

We are using Kendo UI grid to display some records. The requirements need us to have a column (Say "File Name")shown as a text box when the user clicks on "Edit". However, when user clicks on the "Create" button in the toolbar, the same column should be replaced with a File Select control which will allow the user to select a file from his machine. The other columns remain the same. I have already tried searching through Stack Overflow as well as the Kendo UI Grid forums, but to no avail. Is there any way to achieve this? Any pointers will be of great help.

问候,尼基尔

推荐答案

不支持使用不同的编辑器模板进行创建/编辑.您需要使用网格的 edit 事件将该文本输入更改为使用 JavaScript 输入文件.要区分编辑和创建,您可以使用模型的 isNew() 方法.即

Using different editor templates for create/edit is not supported. You need to use the edit event of the Grid to change that text input to file input with JavaScript. To distinguish between edit and create you can use the isNew() method of the model. i.e.

edit:function(e){
      if(e.model.isNew()){
          //replacement logic
      }
 }

涵盖了类似的问题 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆