Hi,
I come across and issue with the latest Trinidad release and would like to ask
for expert advice.
Below please find a snippet of the code that came with the Trinidad 2 beta
demo. It works well in a jsp JSF page:
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:tr="http://myfaces.apache.org/trinidad">
<jsp:directive.page contentType="text/html;charset=utf-8"/>
<f:view>
<tr:document title="Dynamic Table Demo">
<tr:form>
<tr:messages/>
<tr:panelGroupLayout layout="vertical">
<f:facet name="separator">
<tr:separator/>
</f:facet>
<tr:panelGroupLayout layout="horizontal">
<tr:commandLink immediate="true" text="Component Guide"
action="guide"/>
<tr:spacer width="10"/>
<tr:goLink
destination="http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/tr_table.html"
text="Tag Documentation"/>
<tr:spacer width="10"/>
<tr:goLink
destination="http://myfaces.apache.org/trinidad/skin-selectors.html#table"
text="Skinning Key Documentation"/>
</tr:panelGroupLayout>
<tr:outputFormatted styleUsage="instruction" value="<b>Dynamic
table</b>"/>
<f:verbatim><ul> <li> The table should tolerate RowCounts
which are greater
than the actual RowCount. <li> The table should try
to preserve the page
being viewed, when the rowCounts change. <li> In
the following example,
the table should not render NULL values nor throw
Exceptions: </ul></f:verbatim>
<tr:panelFormLayout>
<tr:inputText label="RowCount" value="#{dynamicTable.rowCount}"
accessKey="R">
<f:facet name="help">
<tr:outputText value="Minimum -1. Maximum 400"/>
</f:facet>
<f:validateLongRange minimum="-1" maximum="400"/>
</tr:inputText>
<tr:inputText label="RowCount (Actual)" accessKey="A"
value="#{dynamicTable.actualRowCount}">
<f:facet name="help">
<tr:outputText value="Minimum 0. Maximum 400"/>
</f:facet>
<f:validateLongRange minimum="0" maximum="400"/>
</tr:inputText>
<tr:inputText label="Block Size" accessKey="B"
value="#{dynamicTable.blockSize}">
<f:facet name="help">
<tr:outputText value="Minimum 0"/>
</f:facet>
<f:validateLongRange minimum="0"/>
</tr:inputText>
<f:facet name="footer">
<tr:commandButton textAndAccessKey="&Update"/>
</f:facet>
</tr:panelFormLayout>
<tr:table var="row" emptyText="No Data" value="#{dynamicTable}"
rows="#{dynamicTable.blockSize}" summary="Dynamic Table">
<tr:column>
<f:facet name="header">
<tr:outputText value="Row"/>
</f:facet>
<tr:outputText value="#{empty row ? 'NULL - This is bad!' :
row}"/>
</tr:column>
<tr:column>
<f:facet name="header">
<tr:outputText value="Number"/>
</f:facet>
<tr:outputText value="#{row * 100}"/>
</tr:column>
</tr:table>
</tr:panelGroupLayout>
</tr:form>
</tr:document>
</f:view>
</jsp:root>
However, when I put the same code into a facelet, it doesn't work. And when I
remove the "tr:panelGroupLayout" it would work but I have to click twice on
"Next / Previous" button and on the drop down. On first click it would simply
re-load the page:
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:tr="http://myfaces.apache.org/trinidad">
<ui:composition template="/templates/baseTemplate.xhtml">
<ui:define name="title">Apache Trinidad Data Table</ui:define>
<ui:define name="content">
<f:view>
<tr:document title="Dynamic Table Demo">
<tr:form id="test">
<tr:messages/>
<tr:panelGroupLayout layout="vertical">
<f:facet name="separator">
<tr:separator/>
</f:facet>
<tr:outputFormatted styleUsage="instruction" value="<b>Dynamic
table</b>"/>
<f:verbatim><ul> <li> The table should tolerate RowCounts
which are greater
than the actual RowCount. <li> The table should try
to preserve the page
being viewed, when the rowCounts change. <li> In
the following example,
the table should not render NULL values nor throw
Exceptions: </ul>
Form: id="test"
</f:verbatim>
<tr:panelFormLayout>
<tr:inputText label="RowCount" value="#{dynamicTable.rowCount}"
accessKey="R">
<f:facet name="help">
<tr:outputText value="Minimum -1. Maximum 400"/>
</f:facet>
<f:validateLongRange minimum="-1" maximum="400"/>
</tr:inputText>
<tr:inputText label="RowCount (Actual)" accessKey="A"
value="#{dynamicTable.actualRowCount}">
<f:facet name="help">
<tr:outputText value="Minimum 0. Maximum 400"/>
</f:facet>
<f:validateLongRange minimum="0" maximum="400"/>
</tr:inputText>
<tr:inputText label="Block Size" accessKey="B"
value="#{dynamicTable.blockSize}">
<f:facet name="help">
<tr:outputText value="Minimum 0"/>
</f:facet>
<f:validateLongRange minimum="0"/>
</tr:inputText>
<f:facet name="footer">
<tr:commandButton textAndAccessKey="&Update"/>
</f:facet>
</tr:panelFormLayout>
<tr:table var="row" emptyText="No Data" value="#{dynamicTable}"
rows="#{dynamicTable.blockSize}" summary="Dynamic Table">
<tr:column>
<f:facet name="header">
<tr:outputText value="Row"/>
</f:facet>
<tr:outputText value="#{empty row ? 'NULL - This is bad!' :
row}"/>
</tr:column>
<tr:column>
<f:facet name="header">
<tr:outputText value="Number"/>
</f:facet>
<tr:outputText value="#{row * 100}"/>
</tr:column>
</tr:table>
</tr:panelGroupLayout>
</tr:form>
</tr:document>
</f:view>
</ui:define>
</ui:composition>
</html>
What am I doing wrong? Your help is greatly appreciated.
Best regards,
Michael
________________________________
CONFIDENTIALITY NOTICE
This e-mail message from Delphi Technology, Inc. is intended only for the
individual or entity to which it is addressed. This e-mail may contain
information that is privileged, confidential and exempt from disclosure under
applicable law. If you are not the intended recipient, you are hereby notified
that any dissemination, distribution or copying of this communication is
strictly prohibited. If you received this e-mail by accident, please notify the
sender immediately and destroy this e-mail and all copies of it.