After searching the treegrid source code and documentation, we found that treegrid is extended from the datagrid and tree. However, in the past, the reload method of the datagrid was used to load the query result data by adding parameters, however, treegrid only executes reload and does not support loading query results with parameters. It may be due to restrictions. The following code cannot load query results:
Copy codeThe Code is as follows:
<Table id = 'treegri' class = 'easyui-treegri' url = '/User/list'> </table>
$ ('# Treegri'). treegrid ('reload', {'name': 'mikel '});
So I went to the official forum to search for related questions and found a valuable post. Why should I count on the treegrid component to asynchronously query data, what about loading the returned json data? The Code is as follows:
Copy codeThe Code is as follows:
Function loadData ()
{
$. Post ('/User/list', {name: 'mikel'}, function (data ){
$ ('# Treegri'). treegrid ('loaddata', data );
}, 'Json ');
}