data structure:
create table web_class (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" varchar(255) NOT NULL, --
"bid" integer, --ID
)
Database data:
{id:1, name:" name 1, bid:0}
{id:2, name:" name 2, bid:0}
{id:3, name:" name 3, bid:1}
{id:4, name:" name 4, bid:1}
{id:5, name:" name 5, bid:3}
{id:6, Name:" name 6 minutes, bid:5}
.
the tree menu to be implemented (similar to the following):
[{"bid":0,"id":1,"name":"1",
"son":[
{"bid":1,"id":3,"name":"3",
"son":[
{"bid":3,"id":5,"name":"5",
"son":[
{"bid":3,"id":6,"name":"6","son":[]}
]
}
]
},
{"bid":1,"id":4,"name":"4","son":[]}
]
},
{"bid":0,"id":2,"name":"2","son":[]}]
it would be best if you could explain the principle.