Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
285
Generate TreeView from 1 table
posted

Hallo, I want to generate my treeview base on the data in my table, for example i have a table TreeStructure that contain

ID -> auto_inc

PARENT_ID -> int

NAME -> character

 

ID is the primary key, PARENT_ID contains ID of it's parent and NAME is the text I want to display

I want to know is there any way i can generate this data into structured treeview automatically? because before this I do it manually with recursive.

Data Sample ( ID / PARENT_ID / NAME )

1 / 0 / IT ,  2 / 0 / SUPPORT , 3 / 0 / SALES

4 / 1 / DEVELOPER , 4 / 1 / NETWORK , 5 / 2 / EDP

 tree result :

- IT

---- DEVELOPER

---- NETWORK

- SUPPORT

----EDP

- HRD

 

thx before :)