Skip to content

Update values in tree view programatically #271

@henkmollema

Description

@henkmollema

Perhaps this is a stupid question, but I can't figure it out: how do I reflect changes to node values I made programatically in the tree view. My use-case is a following:

When a node within a certain array is moved, I want to update a property which represents the sort order of that object programatically.

Roughly the flow:

  1. Capture the global onChange event
  2. Figure out if it's a moveNodes event and get the moved node
  3. Set the value of a child node to an integer which represents the sort order: childNode.childs[6].value = i + 1

So far, so good. But the change is not reflected in the tree view. I could just call editor.set(editor.get()); but that will cause the tree view to collapse.

This leaves me with two options:
Either use above function and expand the node again, however I could not get this working. I tried:

editor.content.removeChild(editor.table);
parentNode.expand();
editor.content.appendChild(editor.table);

Without success though..

Or update the DOM with editor.node._updateDomValue(). This would not work either.

Any advice will be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions