Jump to content

Recommended Posts

  • 5 years later...
Posted
On 4/10/2017 at 5:33 PM, FlavioMacedo said:
Is there any way to edit a node directly in the treeview
12 hours ago, Tokay said:

Up. Does it possible in the actual vesions?

Hello,

I'll post a solution later.

image.png.35cb649d490e636982c66abf3962fbdb.png

Posted

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;

 

Posted
45 minutes ago, Tokay said:

A little question. Could it possible to switch to edit mode with back code?

UniTreeView1.JSInterface.JSCall ?

UniTreeView1.JSInterface.JSCall('editor.disable', []); //editor.enable

 

Posted
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])};')

 

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...