Results 1 to 5 of 5

Thread: Set Cursor Position

  1. #1
    Ext User
    Join Date
    Oct 2007
    Posts
    2
    Vote Rating
    0
      0  

    Default Set Cursor Position

    I'd like to know how I would set the cursor position in a Ext.form.HtmlEditor, smth similar to doing it with a plain DHTML TextArea.


    if (textArea.setSelectionRange) {
    textArea.focus();
    textArea.setSelectionRange(selStart, selEnd);
    } else if (textArea.createTextRange) {
    var range = textArea.createTextRange();
    range.collapse(true);
    range.moveEnd('character', selEnd);
    range.moveStart('character', selStart);
    range.select();
    }

    Help please anyone

  2. #2
    dddu88
    Guest

    Default

    Any solution to the cursor positioning in HtmlEditor? I need to do this as well, after users type words and press enter key, my app will send the words to server and the words will disappear, at that point, I need to reposition the cursor to the start of the first line, right now the cursor always come to next line under the first blank line.
    I debugged in firebug, somehow there are always two <br _moz_dirty=""/> sections in the body html, I tried to overwrite them with just one, but it always came up with two.

    Please help!!

    Thanks in advance.

    Dave

  3. #3
    dddu88
    Guest

    Default

    Hi, all,
    I got it working now, I just need to call e.stopEvent();

    Thanks
    Dave

  4. #4
    Ext User
    Join Date
    Mar 2010
    Posts
    3
    Vote Rating
    0
      0  

    Question Set Focus in TextField by press Enter

    Hi Everyone..
    I want to set cursor to the next textField in my form by using Enter button. But i just don't know how to make it in ext js.. Anyone have an idea for this?

    Please Help Me!!

    Thnks and Regrads,

    Liyana

  5. #5
    Sencha User
    Join Date
    Sep 2015
    Posts
    11
    Vote Rating
    0
      0  

    Default Cursor position

    HI , I need to set cursor position at the end after every onChange event .


    Ext.application({
    name: 'Fiddle',


    launch: function() {


    Ext.create('Ext.form.HtmlEditor', {
    width: 580,
    height: 250,
    enableColors: false,
    enableAlignments: false,
    enableFont: false,
    enableFontSize: false,
    enableFormat: false,
    enableLinks: false,
    enableLists: false,
    enableSourceEdit: false,
    renderTo: Ext.getBody(),
    maxAllowed: 5,
    listeners: {
    change: function(he, newVal ,e) {
    var regex = /(<([^>]+)>)/ig
    var clearVal = newVal.replace(regex, "");
    if (clearVal != this.clearVal) {
    if (clearVal.length >= this.maxAllowed) {
    this.setValue(clearVal.substr(0, this.maxAllowed) + '<font color="#ff0000">' + clearVal.substr(this.maxAllowed, clearVal.length) + '</font>')
    }
    }
    this.clearVal = clearVal;

    //this.win.getSelection().getRangeAt(0).
    }
    }
    });


    }
    });

    Help me out with a perfect solution to this ..
    Thanks in advance

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •