This is a migrated thread and some comments may be shown as answers.

Keep grid cell as input box

1 Answer 732 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marcus
Top achievements
Rank 1
Marcus asked on 08 Jan 2020, 11:09 PM

Hi,

I have an editor grid that has one editable cell. I want that cell to always be the input box (numeric text box in this case) instead of going back to a regular dirty cell after clicking out. So basically always keeping cells in edit mode.How can I achieve this? See attached image for example of what I mean.

 

1 Answer, 1 is accepted

Sort by
0
Tsvetomir
Telerik team
answered on 10 Jan 2020, 12:24 PM

Hi Marcus,

In general, you could create templates that would be always open in read mode of the grid. Add a ClientTemplate:

columns.Bound(c=>c.Name).ClientTemplate("<input data-bind='value: Name' >");

Within the DataBound event handler, bind the input to the respective field. It is important to point out that the name above should correspond to the field name of the column:

function onDataBound(e){
          var rows = this.tbody.children();
          var dataItems = this.dataSource.view();
          for (var i = 0; i < dataItems.length; i++)  {
            kendo.bind(rows[i], dataItems[i]);
          }
}

Bear in mind that this approach might lead to a negative impact on the overall performance of the application due to the binding of the inputs to the underlying model.

 

Best regards,
Tsvetomir
Progress Telerik

Get quickly onboarded and successful with your Telerik UI for ASP.NET MVC with the dedicated Virtual Classroom technical training, available to all active customers.
Tags
Grid
Asked by
Marcus
Top achievements
Rank 1
Answers by
Tsvetomir
Telerik team
Share this question
or