Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Pushpinder Singh
Bug <f:facet name="header"> inside <cc:implementation> not working
June 26, 2012 4:51 PM
Answer

Pushpinder Singh

Rank: Junior Member

Posts: 81

Join Date: July 21, 2010

Recent Posts

Liferay Portal Community Edition 6.0.5 CE (Bunyan / Build 6005 / August 16, 2010)
Jars used for JSF2 in liferay portal: jsf-api-2.1.3-b02.jar, jsf-impl-2.1.3-b02.jar, liferay-faces-alloy-3.0.0-RC1.jar, liferay-faces-bridge-impl-3.0.0-RC1.jar and portlet-bridge-api-2.0.0.jar.


Hi All,
I will appreciate if someone point out alternatives way to sort out following:

I tried to put header of my datatable inside composite component in liferay and seems it is not working. If I remove <f:facet name="header">, than header name is displaying but appearing in all rows (as expected). Below is my composite component code and file trying to use that composite compoent:

/resources/compoents/datatable/columnHeader.xhtml

<?xml version="1.0" encoding="UTF-8"?>
<ui:component xmlns="http://www.w3.org/1999/xhtml"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:cc="http://java.sun.com/jsf/composite"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/1999/xhtml http://www.w3.org/2002/08/xhtml/xhtml1-transitional.xsd">
<cc:interface>
<cc:attribute name="columnHeaderName" required="true" />
<cc:attribute name="columnFieldName" required="true"/>
</cc:interface>
<cc:implementation>
<f:facet name="header">
<span>#{cc.attrs.columnHeaderName}</span>
</f:facet>
</cc:implementation>
</ui:component>



/xhtml/result.xhtml

<?xml version="1.0"?>
<f:view xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:dt="http://java.sun.com/jsf/composite/components/datatable">
<h:body>
<h:form id="hssp-search-result-form-id" styleClass="hssp-common-form">
<h:panelGroup styleClass="hssp-container-back"><h:commandLink styleClass="hssp-back-link" value="Back" action="search"/></h:panelGroup>
<h:dataTable id="hssp-search-result-table-id"
value="#{bean.pagedItems}" var="o"
styleClass="hssp-search-result-table"
captionClass="hssp-search-result-caption"
headerClass="hssp-search-result-header"
rowClasses="hssp-search-result-row-even, hssp-search-result-row-odd"
columnClasses="hssp-search-result-column-one, hssp-search-result-column-two, hssp-search-result-column-three"
footerClass="hssp-search-result-footer">
<f:facet name="caption"><h:panelGrid columns="1"><h:panelGroup>Community Search Results</h:panelGroup></h:panelGrid></f:facet>
<h:column>
<dt:columnHeader columnHeaderName="First Name" columnFieldName="firstName" />
<h:commandLink value="#{o.firstName}" action="#{bean.selectStudent(o)}"></h:commandLink>
</h:column>
......
</h:dataTable>
</h:form>
</h:body>
</f:view>
Neil Griffin
RE: Bug <f:facet name="header"> inside <cc:implementation> not working
June 29, 2012 3:30 AM
Answer

Neil Griffin

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2252

Join Date: July 26, 2005

Recent Posts

I think f:facet needs to be a direct child of h:column. If you put it inside a Facelet composite component, then the TableRenderer class won't be able to find it. I think that's the problem you're seeing. However, you might be able to do something like this though:

1<h:dataTable>
2    <h:column>
3        <f:facet name="header">
4           <my-cc-component />
5        </f:facet>
6    </h:column>
7</h:dataTable>
Pushpinder Singh
RE: Bug <f:facet name="header"> inside <cc:implementation> not working
June 29, 2012 3:31 AM
Answer

Pushpinder Singh

Rank: Junior Member

Posts: 81

Join Date: July 21, 2010

Recent Posts

Thanks Neil for suggestion.
Neil Griffin
RE: Bug <f:facet name="header"> inside <cc:implementation> not working
June 29, 2012 3:31 AM
Answer

Neil Griffin

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2252

Join Date: July 26, 2005

Recent Posts

My pleasure -- hope it works out well for you.