Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Updating Primefaces TabView Title  RSS feed

 
Jarrod Rackley
Ranch Hand
Posts: 30
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a TabView that generates the numbers of tabs, titles and content based off of the selected project from another field. I have managed to get it to load the proper number of tabs and content, but the first tab title displays the title of the first tab from the previous query.

The jsf is:



And the method handling the content and number of tabs:



The method findAssociatedEquipment() is called when it recieves a selected project to display.

The command button calls the update for panelGroup "equipmentWrapper". It updates fine for the ui:include and generates the correct number of tabs in the correct order.

So for example the first query might only generate one tab for an 881 device. Then if you select a project that should have a 2911 and 2960 it will correctly load both, but the title for the first tab will retain 881. Should you select a third it will have the title 2911 from the second project.

While it's not a big issue, I am not sure what is causing it or what the best way to correct it would be.
 
Tim Holloway
Bartender
Posts: 18713
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oracle seems to be promoting use of JSTL in JSF these days. I do not. Originally, JSTL did not work at all well on JSF pages, and even in JSF2, where efforts have been made to make them more compatible, people frequently have problems.
 
Jarrod Rackley
Ranch Hand
Posts: 30
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have read another who does not promote it as well. I initially tried to avoid it, but I was having trouble with the TabView including the right pages as it created each tab. If I have the wrapper do one more update from something like changing readonly it will display the proper titles. Just not entirely sure what was causing it.
 
Tim Holloway
Bartender
Posts: 18713
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're going to do "looping" on the View Template, it's usually better to use ui:repeat.

However, I'm not sure that the TabView was intended to be constructed this way. Typically, collection container objects such as tables and tabs regulate their sub-components by how their backing Models are designed. The Controller will then construct the appropriate number of rows (or tabs) based on what it sees in the Model without the need for explicit logic on your part.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!