title: Kendo Grid how to programmatically focus a grid cell and block select the text
body: <p>I have a kendo grid with edit mode set to incell.</p>
  
  <p>What is the most elegant way of programmatically focus a particular cell to force it into an edit mode?</p>
  
  <p>Let's say I have a grid where column 1 and 6 are editable. As soon as user finishes typing something into column 1, I'd like the column 6 textbox to be automatically focused and enabled for editing so that the user doesn't have to manually click on the next editable gridcell for the same row.</p>
  
  <p>This is what I'm doing at the moment:</p>
  
  <pre><code>//Focuses the editable cell at given row/column index.
  //Closes the previously editing cell
  //EX: setGridFocus(SALE_01_DIV_GRID,0,0) --&gt; Focuses SALE_01_DIV_GRID (0,0)
  function setGridFocus(gridID, rowIndex, colIndex)
  {
      var grid = $('#' + gridID).data('kendoGrid');
      grid.closeCell();
  
      setTimeout(function(){
          var cell = $('#' + gridID).find('tbody tr:eq('+rowIndex+') td:eq('+colIndex+')');
          grid.editCell(cell);
          var editTextCell = cell.find("input.k-formatted-value");
  
          editTextCell.focus(function() {
              $(this).select().mouseup(function (e) {
                  e.preventDefault();
                  $(this).unbind("mouseup");
                  e.select();
              });
          });
          cell.find("input[type=text]").select();
          editTextCell.selectall();
      },50); 
  }
  </code></pre>
  
  <p>First of all, I'm using setTimeout to implement what is seemingly a trivial function so this doesn't seem like the ideal approach.</p>
  
  <p>Secondly, the above function only works when it feels like it (Only works half of the time from testing. Probably expected from setTimeout function). I feel like this has to do with the order of events called internally in Kendo Grid.</p>
  
  <p>Thirdly, I'd like to block select the text that's inside the cell being focused. editTextCell.selectall(); doesn't work for this purpose.</p>
  
  <p>I'd appreciate any guidance.</p>