KendoUI Grid - Select text on cell focus

javascript, kendo-grid, kendo-ui

Solution

It turns out that the focus event was getting fired before I could even wire up the focus event handler. So this was the optimal solution to support all types of fields within the grid row:

        var input = e.container.find("input");
        setTimeout(function () {
            input.select();
        }, 25);

The modified jsfiddle can be viewed here: http://jsfiddle.net/latenightcoder/TrJVK/90

Problem

The cell content selection works successfully for a numeric text box (internally handled as a Kendo NumericTextBox control) but for some reason, it doesn't work with a plain textbox column. Attached is the jsfiddle demo'ing the issue: http://jsfiddle.net/latenightcoder/TrJVK/86 This is the code in the grid setup that's of importance: ``` edit: function (e) { var input = e.container.find("input"); input.focus(function (e) { console.log('focus'); setTimeout(function () { input.select(); }); }); } ```

Original source