EasyUI Forum

General Category => EasyUI for Vue => Topic started by: fengdie on October 23, 2018, 05:18:07 PM



Title: treegrid component how to use lazy load data on rowExpand
Post by: fengdie 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.


Title: Re: treegrid component how to use lazy load data on rowExpand
Post by: jarry 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);
    })
  }
},