Hi, very new to primereact,
Is it possible to programmatically add a new TabPanel to a TabView, or would you just iterate through a list with the panel added and re-render the page?
Is it possible to programmatically select a TabPanel and bring it to the front, or would this be done in a similar way to the above?
Regards
TabView, dynamically add TabPanel
1.No, It is not possible to programmatically add a new TabPanel to a TabView.
2.Yes, It is possible to programmatically select a TabPanel with activeIndex property.
2.Yes, It is possible to programmatically select a TabPanel with activeIndex property.
Code: Select all
constructor() {
super();
this.state = {
activeIndex:0
};
}
...
...
<Button onClick={()=>this.setState({activeIndex:2})}/>
<TabView activeIndex={this.state.activeIndex} onTabChange={(event)=>this.setState({activeIndex:event.index})}>
<TabPanel header="Godfather I" leftIcon="fa-calendar">
</TabPanel>
<TabPanel header="Godfather II" rightIcon="fa-print">
</TabPanel>
<TabPanel header="Godfather III" leftIcon="fa-bell-o" rightIcon="fa-bookmark-o"></TabPanel>
<TabPanel header="Godfather IV" disabled={true}>
</TabPanel>
</TabView>
-
- Information
-
Who is online
Users browsing this forum: No registered users and 8 guests