[zTree] Display and Saving DOM Option

Forge Component
Published on 2019-10-03 by Eduardo Luís
19 votes
Published on 2019-10-03 by Eduardo Luís


I'm using ztree with DOM option for each 2nd level. Just want to know how can I save the selected option value and then display it again on preparation?


Dropdown comes from Auditors Entity. Each 2nd level node has its assigned auditors. How can I make the assigned auditor as default value?


Hello Jeffrey,

if you had a look at the custom DOM example you probably build a peace of HTML code, more concretely a select with the auditors as options.And then,in the tree settings, you added this peace of HTML to he nodes.

The problem with this is that the select will have no option with the selected attribute. The only way i can think to do this is to use javascript (maybe jQuery) to set the correct option as selected using some information present in the node.

Hope i making myself understand. This is not very easy to explain.