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

Call EditRow from within Click handler of custom command

0 Answers 104 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Linus
Top achievements
Rank 1
Linus asked on 15 Nov 2012, 01:25 PM

In my grid I placed a custom command "Copy" which  copies a value of a column to two other values in other columns in the Click-handler CopyClick. Now I would like to enter the edit mode for the row. How can I do that? I tried grid.editRow(row) but it did not worked. Probably I passed the wrong parameter to it. What must row be as a parameter to editRow()?

 

@(Html.Kendo().Grid<MyViewModel>()
    .Name("MyGrid")
    .Columns(columns =>
    {
      columns.Command(command =>
      {
            command.Edit();
            command.Destroy();
            command.Custom("Copy").Click("CopyClick");
      });
   
 
    ……
 
    function CopyClick(e)
    {
        e.preventDefault();
        var grid = $("#UnterhaltGrid").data("kendoGrid");
        var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
 
        dataItem.Val1 = dataItem.Val0;
        dataItem.Val2 = dataItem.Val0;
 
        grid.refresh();
    }

 

 

 

 

 

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Linus
Top achievements
Rank 1
Share this question
or