JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
<script src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
<table id="tg" style="width:600px;height:250px">
<thead>
<tr>
<th data-options="field:'name'" width="220">Name</th>
<th data-options="field:'f2'" width="100"></th>
<th data-options="field:'f3'" width="150"></th>
</tr>
</thead>
</table>
JavaScript
$('#tg').treegrid({
rownumbers: true,
idField: 'id',
treeField: 'name',
loader:function(param,success,error){
if (!param.id){
success(getData1());
} else {
success(getData2());
}
}
});
function getData1(){
return [{id: 1,
name: 'parent 1',
state: 'closed',
parentId: 0}
];
}
function getData2(){
return [{id: 11,
name: 'child 1',
parentId: 1},
{id: 12,
name: 'child 2',
parentId: 1},
{id: 13,
name: 'child 23',
parentId: 1}
]
}