Kendo UI grid - different templates for Edit and C

2019-02-17 15:44发布

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

标签: kendo-ui
1条回答
Summer. ? 凉城
2楼-- · 2019-02-17 16:04

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.

查看更多
登录 后发表回答