EasyUI Forum
May 02, 2024, 05:51:33 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: treegrid component how to use lazy load data on rowExpand  (Read 4811 times)
fengdie
Jr. Member
**
Posts: 87


View Profile Email
« on: October 23, 2018, 05:18:07 PM »

数据层级太多,数据量大。我想异步加载数据。但是不知道要怎么处理。
There are too many data levels and a large amount of data. I want to load data asynchronously. But I don't know what to do.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: October 23, 2018, 08:08:49 PM »

Bind the 'onRowExpand' event on the TreeGrid component. When a node has no children, load them and attach to the parent node.
Code:
onRowExpand(row){
  if (!row.children || !row.children.length){
    this.getChildren(row.id).then(children => {
      this.$set(row,'children',children);
    })
  }
},
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!