EasyUI Forum

General Category => EasyUI for Vue => Topic started by: kpeng99@126.com on March 24, 2020, 09:17:30 PM



Title: how to remove row on treegrid of easyui for vue
Post by: kpeng99@126.com on March 24, 2020, 09:17:30 PM
Hi,
Would you please tell me how to remove row on treegrid of easyui for vue?
I can't find any mehtods on the documents.
Thanks a lot!!

William


Title: Re: how to remove row on treegrid of easyui for vue
Post by: jarry on March 29, 2020, 01:50:48 AM
The code below shows how to remove the selected row from the TreeGrid.
Code:
<TreeGrid
style="height:250px"
:data="data"
idField="id"
treeField="name"
:selection="selection"
@selectionChange="selection=$event"
>
...
Code:
if (this.selection.parent) {
  const index = this.selection.parent.children.findIndex(
    row => row == this.selection
  );
  if (index >= 0) {
    this.selection.parent.children.splice(index, 1);
  }
} else {
  const index = this.data.findIndex(row => row == this.selection);
  if (index >= 0) {
    this.data.splice(index, 1);
  }
}
this.data = this.data;