My team got some problems with adding a new p:tab which contains ivycomponent. In the first tab of the p:tabview contains a p:datatable. A new p:tab should created/opened each time if the user clicks a row in the datatable.

In the new p:tab should include a ivycomponent with 2 parameters, which looks like following: alt text

Has anyone already gained experience with loading ivycomponent(s) within a dynamic p:tab? Thank you for sharing!

Kind regards

NWK Team

asked 05.03.2015 at 11:01

nwk2Team's gravatar image

nwk2Team
(suspended)
accept rate: 0%

edited 05.03.2015 at 11:03


First the p:tabView should be bound to managed bean, so that we can access the UIComponent from code:

< !-- bind to a bean property so that we can manipulate it later in code:
http://stackoverflow.com/questions/4052581/dynamically-generate-tabs-with-primefaces/4722270#4722270 -->
< p:tabView id="tabs" binding="#{tabController.view}" />

The bean must at least contain the setters and be requestScoped:

@ManagedBean
@RequestScoped
public class TabController {
    private TabView view;
    public TabView getView() {
      return view;
    }
    public void setView(TabView view) {
      this.view = view;
    }

Then a new tab can be added from process logic. Its seems to be a little tricky to pass the start parameters correctly. They must be passed a string el-expression even if the object behind it is already resolved elsewhere: alt text

The full demo project can be downloaded here: ComponentCreation_51.iar

link

answered 06.03.2015 at 09:21

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958
accept rate: 70%

edited 07.03.2018 at 10:33

Alex%20Suter's gravatar image

Alex Suter ♦♦
3.1k122247

Hi Reguel,

Thank you for your demo. It works like a charm.

Kind regards

NWK Team

(06.03.2015 at 12:30) nwk2Team nwk2Team's gravatar image

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×58
×51
×33

Asked: 05.03.2015 at 11:01

Seen: 5,345 times

Last updated: 07.03.2018 at 10:33