Skip to content

Commit

Permalink
[add] an example on using rootId tree prop in a layout cell with auto…
Browse files Browse the repository at this point in the history
…load
  • Loading branch information
mafanya23 committed Jul 17, 2024
1 parent f019aab commit c0dd660
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion docs/tree/api/tree_rootid_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,27 @@ const tree = new dhx.Tree("tree_container");
tree.data.getRoot(); -> "tree_container"
~~~

You should use the `rootId` property, if you render a tree in a layout cell and use the [`autoload`](/tree/api/tree_autoload_config/) option in the Tree configuration object.
You should use the `rootId` property, if you render a tree in a layout cell and use the [`autoload`](/tree/api/tree_autoload_config/) option in the Tree configuration object. For example:

~~~js
const layout = new dhx.Layout("layout", {
type: "space",
rows: [
{
id: "tree"
}
]
});

const ROOT_ID = "tree";
const tree = new dhx.Tree(null, {
autoload: "https://docs.dhtmlx.com/suite/backend/autoload",
rootId: ROOT_ID
});
tree.data.load(`https://docs.dhtmlx.com/suite/backend/autoload/?id=${ROOT_ID}`);

layout.getCell("tree").attach(tree);
~~~


@changelog: added in v7.0

0 comments on commit c0dd660

Please sign in to comment.