Kendo UI grid - different templates for Edit and Create

为君一笑 提交于 2019-12-19 03:21:41

问题


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.

Regards, Nikhil


回答1:


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
      }
 }

Similar question is covered here.



来源:https://stackoverflow.com/questions/14321396/kendo-ui-grid-different-templates-for-edit-and-create

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!