Assuming that you have chosen the default value for loadOnDemand
, I would suggest to map the id
of the node in one column (id
) and the text in another (text
) and the id
of the parent node in another (pid
).
So the following tree:
root -+- Node1
+- Node2 -+- Node2.1
| +- Node2.2
+- Node3
Would be stored as:
ID PID TEXT
------- ------- --------
root null Root
node1 root Node1
node2 root Node2
node3 root Node3
node2.1 node2 Node2.1
node2.2 node2 Node2.2
Each time that KendoUI wants to expand
a node, if will send a request with the id
of the node being expanded
Example:
http://myserver/getChildren?id=node2.2
Which selects the sub-nodes of the node Node2.2 (which id
is node2.2). And the SQL statement would be:
SELECT ID, TEXT FROM KENDO_TREE WHERE (PID = 'node2.2');