ParamQuery grid support forum
General Category => Help for ParamQuery Grid (free version) => Topic started by: twz on May 08, 2014, 05:55:48 am
-
When a cell is selected for editing, the cursor appears at the start of the text. If you want to replace the text you need to delete the current contents first.
I would like the current contents to be highlighted automatically, so I can just start typing to replace the contents.
I'm surprised there doesn't seem to be an option for this - and nobody seems to have mentioned it before - or am I missing something obvious?
-
selection of text in editor is inbuilt only in PRO using a simple parameter
however you can write your own method to do it.
$grid.on( "focus", "input,textarea,div[contenteditable=true]", function(evt){
//code here to select text of $(this)
});
http://stackoverflow.com/questions/985272/jquery-selecting-text-in-an-element-akin-to-highlighting-with-your-mouse
-
Thanks for your reply.
I struggled with this for a while, but got it working eventually. Note: I had to select the text of 'this', not '$(this)'
-
Just to clarify - the reason I needed 'this' and not '$(this)' is that the code I used from your link was pure Javascript - so it was expecting a DOM element, not a jQuery object.