You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi
Im opening a modal when the node is clicked and have separate event handler for the save button. The original tree is constructed via consuming HTML.
In this event handler i pick up node id from the modal and get the tree instance: let saveNode = $('#treeLoad').jstree(true).get_node(document.getElementById('saveJobCategoryBtn').getAttribute("nodeId"))
writing saveNode.text console checks out ok:
<span id="dp-jobcategory-node-content">
<span id="dp-jobcategory-code"> old code </span>:
<span id="dp-jobcategory-description"> old desc. </span>
</span>
Some boring code removed from my example where i construct the new text field in the node, i end up with resultTextAsHTML that contains:
<span id="dp-jobcategory-node-content">
<span id="dp-jobcategory-code">some other code</span> :
<span id="dp-jobcategory-description"> Some other description </span>
</span>
At the end of the event handler i have:
$('#treeLoad').jstree('rename_node', [saveNode, "123"] ) // also tried with saveNode.id same result
// $('#treeLoad').jstree('rename_node', [saveNode, resultTextAsHTML] ) //fails in the same way as "123" maybe for other reasons?
console.log($('#treeLoad').jstree(true).last_error())
$('#treeLoad').jstree(true).refresh;
Last error is empty [] but the text fields of the node is now undefined and is rendered as such in three.
Any help is much appreciated.
Im also considering if going about this the wrong way and i should have let the complex value elements be attributes on the original html li element and then just construct a simple string for the text fields on tree load?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi
Im opening a modal when the node is clicked and have separate event handler for the save button. The original tree is constructed via consuming HTML.
In this event handler i pick up node id from the modal and get the tree instance:
let saveNode = $('#treeLoad').jstree(true).get_node(document.getElementById('saveJobCategoryBtn').getAttribute("nodeId"))
writing saveNode.text console checks out ok:
Some boring code removed from my example where i construct the new text field in the node, i end up with resultTextAsHTML that contains:
At the end of the event handler i have:
Last error is empty [] but the text fields of the node is now undefined and is rendered as such in three.
Any help is much appreciated.
Im also considering if going about this the wrong way and i should have let the complex value elements be attributes on the original html li element and then just construct a simple string for the text fields on tree load?
Best
Jens
Beta Was this translation helpful? Give feedback.
All reactions