EasyUI Forum

General Category => EasyUI for React => Topic started by: kifni41 on August 25, 2020, 09:35:45 PM



Title: [SOLVED] Tree: How to select item on first load
Post by: kifni41 on August 25, 2020, 09:35:45 PM
How to set a tree item ? no example i can find in documentation,

is it use 'selectNode' and how to do it?
when first load, i want to set an item as highlighted/selected,

i tried this, not work, eheh
Code:
componentDidMount() {
   setTimeout(()=>{
         this.tree.selectNode({iconCls:"icon-table", text: "TABLE 2", to: "/table2"})
     },2000);
}



Title: Re: Tree: How to select item
Post by: jarry on August 26, 2020, 01:52:48 AM
Please set the 'selection' property for the Tree component.
Code:
<Tree
  data={this.state.data}
  selection={this.state.selection}
  onSelectionChange={this.handleSelectionChange.bind(this)}
/>


Title: Re: Tree: How to select item
Post by: kifni41 on August 26, 2020, 09:12:55 PM
thanks, work.
i didn't think like that before  ;D