How to use p:tabView with composite component and ui:insert?

UI Components for JSF
Post Reply
miedrl
Posts: 8
Joined: 22 Jul 2021, 13:21

11 Aug 2022, 08:10

I am trying to use p:tabView in my template and want to insert all p:tab via ui:insert but the p:tab is also wrapped in a composite component. Problem: With my code, the p:tabView is rendered but is empty, the p:tab (list items within <ul class="ui-tabs-nav" .../>) are not rendered. If I don't use my composite component but directly put p:tab within <ui:define name="tabMenu".../> it works. How can I make this work?

My template:

Code: Select all

<p:tabView id="tab_menu">
    <ui:insert name="tabMenu" />
</p:tabView>
My composite component "tabMenuEntry":

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:p="http://primefaces.org/ui"
   xmlns:cc="http://java.sun.com/jsf/composite">

<head>
</head>
<body>
   <cc:interface>
      <cc:attribute name="id" required="true" />
      <cc:attribute name="value" required="true" />
      <cc:attribute name="title" />
      <cc:attribute name="disabled" default="false" />
   </cc:interface>
   <cc:implementation>

      <p:tab id="tabMenuEntry"
         title="#{cc.attrs.value}"
         titletip="#{cc.attrs.title}"
         disabled="#{cc.attrs.disabled}" />

   </cc:implementation>
</body>
</html>
The usage of my composite component:

Code: Select all

<ui:define name="tab1">
    <inno:tabMenuEntry id="risikofragen"
	value="Tab1"
	disabled="#{ShowcaseView.disabled}" />
    <inno:tabMenuEntry id="tab2"
	value="Tab2"
	disabled="#{ShowcaseView.disabled}" />
    <inno:tabMenuEntry id="Tab3"
	value="Tab3"
	disabled="#{ShowcaseView.disabled}" />
</ui:define>	

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

11 Aug 2022, 09:43

that is just not supported currently as the renderer of TabView and AccordionPanel just looks for p:tab/p:tabs child
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 57 guests