PDA

View Full Version : Caret Position within Ext.Editor



lukefowell89
1 Mar 2011, 1:35 AM
How would I go about positioning the caret within an Ext.Editor textfield. I am adding formulas such as =SUM() and would like the cursor to be positioned inside here (**HERE**) on the formula. So that my script for a formula selection box can or the user can add the cell references in there.

Anyone?

bluehipy
8 Feb 2012, 3:21 AM
Nowdays with HTML5 would be:

var pos = this.fieldEl.dom.value.indexOf("\(")+1;
if( -1 !== pos)
{
this.fieldEl.dom.selectionStart = pos;
}

If anyone else touch this page looking for caret positioning :)