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

[Solved] Programmatically turn on edit in firs grid cell

1 Answer 1485 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Janusz
Top achievements
Rank 1
Janusz asked on 19 Feb 2015, 02:35 PM
Hi,

I have grid with incell editing. How can I turn on edit (enter into editor and set focus) in first cell with button click ?

1 Answer, 1 is accepted

Sort by
0
Venelin
Telerik team
answered on 20 Feb 2015, 01:43 PM
Hi Janusz,

You can achieve the desired functionality by using the editCell method. Here is how:

JS:

$("#grid").kendoGrid({
    dataSource: dataSource,
    navigatable: true,
    pageable: true,
    height: 550,
    toolbar: ["create", "save", "cancel"],
    columns: [
        "ProductName",
        { field: "UnitPrice", title: "Unit Price", format: "{0:c}", width: 120 },
        { field: "UnitsInStock", title: "Units In Stock", width: 120 },
        { field: "Discontinued", width: 120 },
        { command: "destroy", title: " ", width: 150 }],
    editable: true,
 
    dataBound: function (e) {
        var sender = e.sender;
        var cellToEdit = sender.content.find("td:eq(0)");
        sender.editCell(cellToEdit);
    }
});

The relevant part of the code is in yellow. For your convenience I have also created a dojo example. You can observe that the first cell is programmatically put in edit mode as you required.

Regards,
Venelin
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Janusz
Top achievements
Rank 1
Answers by
Venelin
Telerik team
Share this question
or