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

查看:54
本文介绍了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.

关于, 尼基尔

推荐答案

不支持将不同的编辑器模板用于创建/编辑.您需要使用Grid的 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天全站免登陆