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

Batch Grid Edit Cell when not in Editor Template

2 Answers 128 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ASAP Developer
Top achievements
Rank 1
ASAP Developer asked on 14 Mar 2014, 09:07 PM
I'm using a batch grid with InCell editing and am wanting to know a way to set a particular column into edit mode.  

I've tried using editCell, and so far it hasn't caused any of the cells to go into edit mode :(

In this particular case, we have a ClientTemplate column specified which has a button (really its a link...) in it.  When the user clicks the button I would like a particular cell in that row to switch to edit mode.  For reference here's what the specific column template looks like:
 columns.Template(t => { }).HeaderTemplate("")
                .ClientTemplate(@"
                    <a href='javascript: void(0)' class='abutton SecondaryActiveBtn' onclick='editVariableRate(this)' title='Edit'>Edit</a>")
                .Width(100).Title("");

Here is the particular javascript method that gets called on the button click:
 function editVariableRate(element) {
        grid = $("#variableFee").data("kendoGrid");     
        var cell = $(element).closest("tr").find("td:eq(2)");
        grid.editCell(cell);
}

Am I doing something wrong here because the particular column never goes into edit mode.



2 Answers, 1 is accepted

Sort by
0
ASAP Developer
Top achievements
Rank 1
answered on 17 Mar 2014, 07:27 PM
For reference, I can do the following successfully using the same "cell" variable:

var cellIndex = grid.cellIndex(cell);

and cellIndex gets assigned correctly, so I don't think its a problem of selecting the particular cell...
0
ASAP Developer
Top achievements
Rank 1
answered on 18 Mar 2014, 02:48 AM
While I did not get a response.. after far too long of banging my head into my desk I have discovered the solution!  All I did was swap the link in the column template to be a input button and it works fine now.  

<input type='button' class='abutton SecondaryActiveBtn' onclick='editVariableRate(this)' value='Edit'></input>


I hope this helps prevent some future soul from having to go through the turmoil I have gone through :)  Cheers!
Tags
Grid
Asked by
ASAP Developer
Top achievements
Rank 1
Answers by
ASAP Developer
Top achievements
Rank 1
Share this question
or