When a double click is preformed to edit a cell the text is all selected, is there a way to stop this? I was going to use a JS trick but in the event editCellStarted its to early as the selection happens after this event. Is there a way to do this?
Hello,
Thank you for your post.
Can I ask you, do you have enabled row editing, I mean when you double click the cell that you want to edit, this cell became editable, and the content in it is selected, right? What do you want to happen if you start to edit, to change the default text selection in the editor when a cell is edited and for example the caret to be at the end of the selected content?
Looking forward to hearing from you!
Preferably, I want the Caret to be at the end and the current text not highlighted.
I get this now.
[CELL TEXT] highlighted ( selected ) text
I want this.
CELL TEXT|<--- caret
I could not find the enabled row editing option in the help HTML but I dont use it, so I guess its at default.
Thank you for the clarification!
I have create you a sample in order to show you how to set the caret at the end of an input element. You need to handle UpdatingCellStarted event of the igGrid and there get the input element and apply it a simple custom function that sets the caret to the end. Also keep in mind that you need to use timer in order to wait a little before manipulate the caret correctly.
Useful reference:
http://help.infragistics.com/jQuery/2013.2/ui.iggridupdating#events
If you need further assistance, contact me!
ok, having a hard timing understanding this $.fn thing? First off, I dont write my code in this style, I use the older infragistics style.
//init code. $.ig.loader( function () { inIUDiv.igGrid( {
...
editCellStarted: function ( evt, ui ) { var editor = $( "input.ui-igedit-field" ); ... }
I dont get how $.fn is in anyway part of editor?
so I tried to simplify it
editCellStarted: function ( evt, ui ) { var editor = $( "input.ui-igedit-field" ); setTimeout( function () { editor.caretToEnd = function () { alert(3) this.prop("selectionStart", this.val().length).focus(); }; }, 150 ); }
but I guess anonymous functions wont work huh?
Thank you for using our product.
If there is something else that I could help you with, contact me.
In jQuery, the fn property is an alias to the prototype property (jQuery.fn === jQuery.prototype). The real benefit from fn is that you can add your own functionality into jQuery, and remember, this keyword will refer to the jQuet object.
Example:
Use of fn is to simplify the code, although you've said that you don want to use it, so my suggestion is to write your code like:
If you need further assistance on this matter, do not hesitate to contact me!