Title: Tree Format
Post by: BinaryCode on June 19, 2023, 01:12:09 PM
How to format a node tree to display 2 or more rows?
Title: Re: Tree Format
Post by: jarry on June 20, 2023, 08:18:17 PM
Please look at this example. <!DOCTYPE html> <html>
<head> <meta charset="UTF-8"> <title>Basic Tree - jQuery EasyUI Demo</title> <link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/themes/icon.css"> <script type="text/javascript" src="https://www.jeasyui.com/easyui/jquery.min.js"></script> <script type="text/javascript" src="https://www.jeasyui.com/easyui/jquery.easyui.min.js"></script> <script> var data = [{ "id": 1, "text": "My Documents", "children": [{ "id": 11, "text": "Photos", "state": "closed", "children": [{ "id": 111, "text": "Friend" }, { "id": 112, "text": "Wife" }, { "id": 113, "text": "Company" }] }, { "id": 12, "text": "Program Files", "children": [{ "id": 121, "text": "Intel" }, { "id": 122, "text": "Java", "attributes": { "p1": "Custom Attribute1", "p2": "Custom Attribute2" } }, { "id": 123, "text": "Microsoft Office" }, { "id": 124, "text": "Games", "checked": true }] }, { "id": 13, "text": "index.html" }, { "id": 14, "text": "about.html" }, { "id": 15, "text": "welcome.html" }] }] $(function(){ $('#tt').tree({ data: data, animate: true, formatter: function(node){ return '<div>'+node.text+'</div><div>others</div>'; } }) }) </script> <style> .mtree .tree-node{ min-height: 26px; height: auto; } .mtree .tree-hit,.mtree .tree-icon{ vertical-align: top; } .mtree .tree-title{ height: auto; } </style> </head>
<body> <ul id="tt" class="mtree"></ul>
</body>
</html>
|