Rename tree node in primeng

889 views Asked by At

I am using primeng tree component, and I need to edit the name of selected tree node inline. I have implemented rename of the node with another dialog box. but, I want to rename it inline.

Is it possible to rename the selected tree node?

1

There are 1 answers

0
Aman On

Yes i have implemented same functionality in tree node,

you will face the actual issue in IE. IE wont allow to input any text when it is draggable so you need to make it false when click on it or so.

//On blur


public renameFolder(selectedNode: TreeNode): any {
    let flag: Boolean = false;
    selectedNode.type = null;
    selectedNode.draggable = true;
    selectedNode.droppable = true;
}



/**
   * To rename selected folder when rename folder
   * is selected from context menu.
   * type is used to match it with ng-template.
   */
  private renameFolderContextMenu(selectedNode: TreeNode) {
    this.renameFolderName = selectedNode.label;
    selectedNode.type = 'renameFolder';
    selectedNode.draggable = false;
    selectedNode.droppable = false;
  }