This is a migrated thread and some comments may be shown as answers.

Simulate in place editing

1 Answer 69 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 16 Apr 2017, 02:16 PM

Hi,
I am using the Tree List control with Auto Generate Columns set to false. I want to use in place editing, but the documentation states that in place editing is only for Auto Generate Columns. I have placed an HTML text box in an item template with an onClick event.

<input id="txtDescription" type="text" value="<%# Eval("Description") %>" onclick="Field_onClick(this, false);" onblur="Field_onBlur(this);" readonly="readonly" />

function Field_onClick(txt, allowBlank) {
    if (_mode == mode.Params) {
        _tlConfig.AllowEdit = true;
        txt.readOnly = '';
        txt.focus();
    }
}

The problem is that I have to click on the text box twice before I can edit it contents. Is there a way around this problem?

 

Thanks, Paul.

1 Answer, 1 is accepted

Sort by
0
Paul
Top achievements
Rank 1
answered on 18 Apr 2017, 12:36 PM

I was able to solve the problem by selecting any existing text after setting focus:

txt.select()

or

var txtLen = txt.length;
txt.setSelectionRange(0, txtLen);

Tags
TreeList
Asked by
Paul
Top achievements
Rank 1
Answers by
Paul
Top achievements
Rank 1
Share this question
or