title: Editing mode for kendogrid selected cell
body: <p>I have a kendo grid with 1 editable column, when I execute a certain javascript function I want to enable editing for the currently selected cell. The point is that this happens programmatically and not by clicking the cell. What the code currently does is select the cell that needs to be set to editing mode but doesn't enable the editing mode itself.</p>
  
  <p><strong>Edit (fix):</strong></p>
  
  <p>I had to change the index to the cell selection to +1 while the row selection stayed the same (probably because the header counts as a cell or something). There were also functions that took away the focus from the editing field which closed it instantly.</p>
  
  <p>JS:</p>
  
  <pre><code>$('#txtBarcode').keydown(function (e) {
      var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
      if (key == 13) {
  
          var grid = $("#PickListDetailGrid").data("kendoGrid");
          var dataSource = $("#PickListDetailGrid").data("kendoGrid").dataSource;
          var allData = dataSource.data();
          var code = this.value;
  
          $.each(allData, function (index, item) {
              if (item.ArticleID == code) {
                  console.log("index :" + index);                    
                  var cell = grid.select("tr:eq(" + index + ") td:eq(" + (5) + ")");
                  grid.editCell(cell); 
              }
          })
      }
  });
  </code></pre>
  
  <p>Grid:</p>
  
  <pre><code>    @(Html.Kendo().Grid&lt;TelerikMvcApp1.Models.PickListLineViewModel&gt;()
                          .Name("PickListDetailGrid")
                          .Columns(columns =&gt;
                          {
                              columns.Bound(c =&gt; c.ArticleName);
                              columns.Bound(c =&gt; c.ArticleID);
                              columns.Bound(c =&gt; c.PickID);
                              columns.Bound(c =&gt; c.LineNum);
                              columns.Bound(c =&gt; c.Quantity);
                              columns.Bound(c =&gt; c.PickedQuantity).HtmlAttributes(new { @id = "test" });
                              columns.Bound(c =&gt; c.Status);
                          })
                          .Editable(editable =&gt; editable.Mode(GridEditMode.InCell))
                          .HtmlAttributes(new { style = "height: 75%;" })
                          .Scrollable()
                          .Groupable()
                          .Sortable()
                          .Selectable()
                          .RowAction(row =&gt;
                          {
                              if (row.DataItem.Quantity == row.DataItem.PickedQuantity)
                              {
                                  row.HtmlAttributes["class"] = "k-state-selected";
                              }
                          })
                          .ToolBar(toolbar =&gt;
                          {
                              toolbar.Custom().Text("Return to Picklists")
                              .HtmlAttributes(new { @style = "color:black; width:100%; height:50%;" })
                              .Action("Picklist", "PickList");
                          })
              .DataSource(dataSource =&gt; dataSource
                  .Ajax()
                  .Events(events =&gt; events.Error("error"))
                  .Model(model =&gt; model.Id(i =&gt; i.PickID))
                  .Model(model =&gt;
                  {
                      model.Field(f =&gt; f.PickID).Editable(false);
                      model.Field(f =&gt; f.ArticleID).Editable(false);
                      model.Field(f =&gt; f.LineNum).Editable(false);
                      model.Field(f =&gt; f.Quantity).Editable(false);
                      model.Field(f =&gt; f.ArticleName).Editable(false);
                      model.Field(f =&gt; f.Status).Editable(false);
                      model.Field(f =&gt; f.PickedQuantity).Editable(true);
                  })
                  .Read(read =&gt; read.Action("PickLines_Read", "PickList", new { name = "id", id = Model.FirstOrDefault().PickID }))
                  .Update(update =&gt; update.Action("submitPickList", "PickList"))
          )
        .Events(events =&gt; events
          .Change("onChange")
          .Edit("onEdit")
          .Save("onSave"))
      )
  </code></pre>
  
  <p>On Edit:</p>
  
  <pre><code>function onEdit(e) {
      e.container.find("input").bind("focus", function () {
          if (this.style.display != "none") {
              var element = this;
              setTimeout(function () {
                  element.select();
              })
          }
      })
  
      setTimeout(function () {
          document.activeElement.select();
      })
  }
  </code></pre>