Solution to dynamic loading of data using the treegrid component of EasyUI

Source: Internet
Author: User

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 ');
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.