Forums de discussion

Bug <f:facet name="header"> inside <cc:implementation> not working

Pushpinder Singh, modifié il y a 11 années.

Bug <f:facet name="header"> inside <cc:implementation> not working

Junior Member Publications: 84 Date d'inscription: 21/07/10 Publications récentes
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>
thumbnail
Neil Griffin, modifié il y a 11 années.

moved to English sub-category of Liferay Faces

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
moved to English sub-category of Liferay Faces
thumbnail
Neil Griffin, modifié il y a 11 années.

RE: Bug <f:facet name="header"> inside <cc:implementation> not working

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
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:

<h:datatable>
    <h:column>
        <f:facet name="header">
           <my-cc-component />
        </f:facet>
    </h:column>
</h:datatable>
Pushpinder Singh, modifié il y a 11 années.

RE: Bug <f:facet name="header"> inside <cc:implementation> not working

Junior Member Publications: 84 Date d'inscription: 21/07/10 Publications récentes
Thanks Neil for suggestion.
thumbnail
Neil Griffin, modifié il y a 11 années.

RE: Bug <f:facet name="header"> inside <cc:implementation> not working

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
My pleasure -- hope it works out well for you.