How can I design an infinitely classified database table? how can I design the best database table?
I am writing multi-level menu background
I don't know how to write well ..........
We plan to use jstree as the frontend ..
Reply to discussion (solution)
The basic data structure of jstree is
{ attributes: { id : "node_identificator", some-other-attribute : "attribute_value" }, data: "node_title", // Properties below are only used for NON-leaf nodes state: "closed", // or "open" children: [ /* an array of child nodes objects */ ] }
Attributes is a custom attribute, and data is the text displayed on the node. when the state value is closed, there is an identifier before the node that indicates that the node can be expanded. Also, you can refer to the Datastores section in documentation.html.
Jstree dynamically loads subnodes.
Therefore, in addition to the storage of basic data, your table must have at least one field indicating the owner of the entry.
The basic data structure of jstree is
{ attributes: { id : "node_identificator", some-other-attribute : "attribute_value" }, data: "node_title", // Properties below are only used for NON-leaf nodes state: "closed", // or "open" children: [ /* an array of child nodes objects */ ] }
Attributes is a custom attribute, and data is the text displayed on the node. when the state value is closed, there is an identifier before the node that indicates that the node can be expanded. Also, you can refer to the Datastores section in documentation.html.
Jstree dynamically loads subnodes.
Therefore, in addition to the storage of basic data, your table must have at least one field indicating the owner of the entry.
In fact, I want to know how to design a database to traverse data to the front-end .. How is the data retrieved from the front end stored in the database ...........
Current node ID, Father's Day ID, path strength of the current node, node name
For example, three data records can be stored in the database for computers, offices, computers, and ultrabodes.
1 0 1 computer, office 2 1 1 1 2 computer machine 3, 2 1 2, 3 Ultrabook
Current node ID, Father's Day ID, path strength of the current node, node name
For example, three data records can be stored in the database for computers, offices, computers, and ultrabodes.
1 0 1 computer, office 2 1 1 1 2 computer machine 3, 2 1 2, 3 Ultrabook
What about the traversal idea? how to ensure that the traversal starts from the top?
The traversal problem does not exist when jstree is used for display.
You only need to provide the id of the parent node, but only the first-level child node of the parent node can be queried.