EasyUI Forum
October 16, 2024, 12:24:27 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: [SOLVED] Tree: How to select item on first load  (Read 8074 times)
kifni41
Newbie
*
Posts: 23


View Profile
« 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);
}

« Last Edit: August 26, 2020, 09:13:16 PM by kifni41 » Logged
jarry
Administrator
Hero Member
*****
Posts: 2276


View Profile Email
« Reply #1 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)}
/>
Logged
kifni41
Newbie
*
Posts: 23


View Profile
« Reply #2 on: August 26, 2020, 09:12:55 PM »

thanks, work.
i didn't think like that before  Grin
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!