-
1. Re: DataTable, Converters and ReRender problem
nbelaevski Jan 20, 2009 9:00 PM (in response to toppac)Hello,
Can you please post page code? -
2. Re: DataTable, Converters and ReRender problem
toppac Jan 20, 2009 9:42 PM (in response to toppac)I can't post the actual code, NDA and all. But I will give the jist of it.
A radio button contains two values representing the different date patterns to use in the Converter<h:selectOneRadio value="#{maintainCatalogAction.selectedDateFormat.value}"> <s:selectItems value="#{maintainCatalogAction.catalogDateFormatList}" var="_dateFormat" itemValue="#{_dateFormat.value}" label="#{_dateFormat.label}" hideNoSelectionLabel="true"/> <a:support event="onclick" action="#{maintainCatalogAction.onClickDateFormat(maintainCatalogAction.selectedDateFormat)}" reRender="catalogSearchResultsPanel,catalogSearchResultsPanelDetails,catalogSearchResultTable,testDataTable"> </a:support> </h:selectOneRadio>
On change of this value it rerenders the testDataTable, which contains the following<rich:dataTable id="testDataTable" value="#{maintainCatalogAction.testList}" width="100%" var="_cat" > <rich:column> <h:outputText value="_cat"/> <h:outputText value="#{maintainCatalogAction.testDate}"> <f:convertDateTime pattern="#{maintainCatalogAction.selectedDateFormat.value}"/> <h:outputText value="#{maintainCatalogAction.selectedDateFormat.value}"/> </h:outputText> </rich:column> </rich:dataTable>
The testDate is just a Date object I instantiate at maintainCatalog creation time. The testList is just a list of String values. When the radio button is changed the value printed for selectedDateFormat is changed during the rerender but the outputText using the converter is not using the new pattern. -
3. Re: DataTable, Converters and ReRender problem
toppac Jan 21, 2009 8:17 PM (in response to toppac)Sorry to be a bumper, but this is kind of critical. I don't think I am asking a hard question. Basically I am trying to figure out if converters are rerun when on a a4j:support rerender. To me it looks like they are not. Not sure if this is something in the JSF spec and lifecycle or whether it is a problem with how a4j:support processes request.
-
4. Re: DataTable, Converters and ReRender problem
mvitenkov Jan 22, 2009 7:37 AM (in response to toppac)For me, when date pattern is changed - it doesn't affect output date format displaying in case radio buttons and tested output placed on the same page.
But when I use a4j:support action for navigation to another page with tested output - changed pattern is applied. Probably date converter doesn't became updated in dom on the same page.
Following bug was posted in JIRA:
https://jira.jboss.org/jira/browse/RF-5841
Thanks for the participation. -
5. Re: DataTable, Converters and ReRender problem
mvitenkov Jan 22, 2009 11:23 AM (in response to toppac)It's not a richfaces bug. JSF feature. Verify the same code without rich and a4j tags.
-
6. Re: DataTable, Converters and ReRender problem
toppac Jan 22, 2009 12:31 PM (in response to toppac)Thanks, that is exactly what I was trying to figure out. Now that we have idenitified as a JSF issue and not a RichFaces problem, is there anything in RichFaces that could fix this? Is there anyway to force the JSF tree to reevaluate the EL for the pattern and reapply it to the text field? If not I guess I have to rethink how I am doing this.
-
7. Re: DataTable, Converters and ReRender problem
christian.yttesen Jan 29, 2009 2:09 AM (in response to toppac)Hi,
I'm having similar issues - I have my pattern in a backing bean (MMM d, yyyy) and using the:
<f:convertDateTime pattern="#{i18nBean.datePattern}" />
various places throughout my project - I can have two properties next to each other:<h:outputLabel for="startDate" value="#{msgs['account.start_date']}:" /> <h:outputText id="startDate" value="#{accountBean.dslAccount.startDate}"> <f:convertDateTime pattern="#{i18nBean.datePattern}" /> </h:outputText> <h:outputLabel for="expiryDate" value="#{msgs['account.expiry_date']}:" /> <h:panelGroup> <h:outputText id="expiryDate" value="#{accountBean.dslAccount.expiryDate} "> <f:convertDateTime pattern="#{i18nBean.datePattern}" /> </h:outputText> <h:commandLink id="lnkShowExtendExpiryDate" actionListener="#{accountPageBean.showExtendExpiryDateDialog}" value="#{msgs['account.extend_expiry_date']}" immediate="true" /> </h:panelGroup>
Displayed as:
Start date: Jan 28, 2009
Expiry date: 2009-03-19
On other pages the conversion works on others again it fails. It is however consistent where it works and where is doesn't - I just can't figure out why.
Toppac - did you get around it?
Any known workarounds? -
8. Re: DataTable, Converters and ReRender problem
nbelaevski Jan 29, 2009 6:28 AM (in response to toppac)Hello,
Workarounds are:
JSP:<h:outputText value="#{custom.testDate}"> <f:converter binding="#{custom.converter}"/> </h:outputText>
public Converter getConverter() { DateTimeConverter converter = new DateTimeConverter(); converter.setPattern(getPattern()); return converter; }
Facelets:<h:outputText value="#{custom.testDate}" binding="#{testBean.valueHolder}"> <h:commandButton action="#{testBean.setConverter}"/>
private UIOutput valueHolder; public UIOutput getValueHolder() { return valueHolder; } public void setValueHolder(UIOutput valueHolder) { this.valueHolder = valueHolder; setConverter(); } public void setConverter() { DateTimeConverter converter = new DateTimeConverter(); converter.setPattern(snippet.getPattern()); this.valueHolder.setConverter(converter); }
In the Java code "snippet" is session-scoped bean that contains pattern wired to request-scoped testBean containing binding to component.