Bug: pa:tabMenu > pa:tab 'rendered' attribute broken

Forum rules
Please note that response time for technical support is within 3-5 business days.
Post Reply
Smurfs
Posts: 11
Joined: 06 Jan 2012, 12:19
Location: Ireland

30 Mar 2017, 14:16

Hi,

I need to control rendering of menu tabs based on user permissions but have hit a snag when setting tab rendered property to false...

Code: Select all

<pa:tab title="Tab title" rendered="false">
.

The snag is that although the tab icon is not rendered as expected, when selecting the next rendered tab the hidden tab title is displayed. Furthermore the remaining tabs become associated with the following tab's content. This is actually easier to see in action than to explain, so to replicate modify atlantis-1.0.0.war demo and change line 11 of WEB-INF\menu.xhtml to

Code: Select all

<pa:tab icon="fa fa-cube" title="Features" rendered="false">
and see for yourself.

The work around is to ignore the rendered attribute and wrap pa:tab with

Code: Select all

<c:if test="..."><pa:tab icon="fa fa-cube" title="Features">...</pa:tab></c:if>
but this is not ideal! Please fix.

Thanks, Andrew
Andrew

PrimeFaces 6.0
Atlantis Theme 1.0.1
Atmosphere 2.4.4
Deltaspike 1.7.2
JBoss Wildfly-8.2
JDK1.8

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

03 Apr 2017, 10:05

Fixed for next version; https://github.com/primefaces/atlantis/issues/9

You can add the following code to TabMenuRenderer.java;

Code: Select all

writer.startElement("div", tabMenu);
writer.writeAttribute("class", "layout-tabmenu-contents", null);
for(int i = 0; i < children.size(); i++) {
   Tab tab = (Tab) children.get(i); 
   
   if(tab.isRendered()) { // line 59. PLEASE ADD THIS CHECK.
      ...
   }
}
writer.endElement("div");
        
writer.endElement("div");

...

Smurfs
Posts: 11
Joined: 06 Jan 2012, 12:19
Location: Ireland

05 Apr 2017, 14:38

Thanks!
Andrew

PrimeFaces 6.0
Atlantis Theme 1.0.1
Atmosphere 2.4.4
Deltaspike 1.7.2
JBoss Wildfly-8.2
JDK1.8

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

06 Apr 2017, 10:57

You're welcome!

Post Reply

Return to “Atlantis - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest