Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
Select all text on click of combo editor in grid cell
posted

I've got a pretty simple requirement but I've tried a number of approaches and can't get any to work.

My requirement: I have an igGrid with a column of editorType combo.  Got it all filled up with a datasource.  The grid's igUpdating edit mode is "cell".  When the user clicks inside of a cell in this column, I want the text of the combo to be fully selected.

What I've tried:

1. Looking for a mere option for this.  Can't seem to find any.

2. Selecting the text on editCellStarting or editCellStarted event of igUpdating.  These events don't always fire when I click on the cell, in fact usually they don't.  I don't know what these events are for but they don't seem to be for handling the user's click on the cell.

3. Handling cellClick on the igGrid, then drilling down using jQuery on ".ui-iggrid-editor" and then calling .igCombo("textInput") to get the text input.  Then I have to call igTextEditor() because it doesn't seem to be initialized as a text editor.  Finally, I call igTextEditor("select", 1, 1000) to select the text.  Unfortunately this does not work consistently.  Often when this is called the igCombo or the text editor do not seem to exist at all in the DOM yet, so no text gets selected.  I have tried hacking in a setTimeout but even this does not work consistently.

I'm running out of options and each of my options is getting more and more hackish.  Is there not a simple way to select the text in a combobox cell in an igGrid when the user clicks on the cell?

Appreciate any help on the matter.

Mike