serializes data to an array of JSON objects
rootId | string|number | the ID of the branch that will be serialized |
all | boolean | defines whether all data or only the filtered data are serialized |
array | serialized data as an array of JSON objects |
$$("tree1").serialize();
By default, the whole tree data are serialized. If you want to serialize a particular branch, pass the ID of the branch to the method:
const branch_data = $$("tree1").serialize("branchId");
By default, only filtered data are serialized. If you want to serialize all data regardless of previous filtering, pass true as the second parameter:
$$("tree1").filter(function(obj){
return obj.value.indexOf("IMG") !== -1;
});
const allData = $$("tree1").serialize(null,true);
Back to top