Jump to content

edit a node directly in the treeview


FlavioMacedo

Recommended Posts

  • 5 years later...

Solution:

1. UniTreeView1.ClientEvents.ExtEvents ->

function afterrender(sender, eOpts) 
{
    sender.editor = new Ext.Editor({
        alignment: 'l-l',
        autoSize: {
            width: 'boundEl'
        },
        field: {
            xtype: 'textfield'
        },
        listeners: {
            complete: function(a,b) {
                ajaxRequest(sender, 'completeedit', {value: b}, false)
            }
        }
    });
}

2. UniTreeView1.ClientEvents.ExtEvents ->

function itemdblclick(sender, record, item, index, e, eOpts)
{
    sender.grid.editor.startEdit(item.id);
}

3. UniTreeView1.OnAjaxEvent ->

procedure TMainForm.UniTreeView1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = 'completeedit' then
  begin
    (Sender as TUniTreeView).Selected.Text := Params.Values['value']
  end;

end;

 

Link to comment
Share on other sites

3 minutes ago, Sherzod said:

Do you want to start edit programmatically? 

If yes, then try:

  with UniTreeView1 do
    if Selected <> nil then
      JSInterface.JSCode('if ('#1'.editor.disabled == false){'#1'.editor.startEdit('#1'.getEl().select(".x-grid-item-selected").elements[0])};')

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...