FlavioMacedo Posted April 10, 2017 Share Posted April 10, 2017 Good Morning. Is there any way to edit a node directly in the treeview Quote Link to comment Share on other sites More sharing options...
Tokay Posted November 18, 2022 Share Posted November 18, 2022 Up. Does it possible in the actual vesions? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 19, 2022 Share Posted November 19, 2022 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. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 19, 2022 Share Posted November 19, 2022 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; Quote Link to comment Share on other sites More sharing options...
Tokay Posted November 19, 2022 Share Posted November 19, 2022 Works well! Thank you very much. A little question. Could it possible to switch to edit mode with back code? UniTreeView1.JSInterface.JSCall ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 19, 2022 Share Posted November 19, 2022 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 Quote Link to comment Share on other sites More sharing options...
Tokay Posted November 19, 2022 Share Posted November 19, 2022 I need something like this: UniTreeView1.JSInterface.JSCall('editor.startEdit Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 19, 2022 Share Posted November 19, 2022 Do you want to start edit programmatically? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 19, 2022 Share Posted November 19, 2022 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])};') Quote Link to comment Share on other sites More sharing options...
Tokay Posted November 19, 2022 Share Posted November 19, 2022 That it! Works as expected. Thank you very much. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.