This content has been marked as final.
Show 4 replies
-
1. Re: reRender Problem
sergeysmirnov Mar 12, 2007 10:40 AM (in response to wklaus)if you still use 1.0.7, you need to use <a4j:region renderRegionOnly="false"> (it is set to false by default in 1.1.0). Also, reRender uses findComponent() approach to find the component with particular id. So, if the re-rendered components are outside of the same form, the path should be different.
<........ reRender=":myform:ktspezid, :myform:kannTextGrid" /> ... <h:form id="myform"> <h:inputHidden value="ktspezid"/> <h:panelGrid id="kannTextGrid"> <h:inputText....> </h:panelGrid> <h:form>
-
2. Re: reRender Problem
gzoller Mar 12, 2007 11:22 AM (in response to wklaus)Hi Sergey,
I'm using 1.1.0 and can't get a nested DataTable to rerender. (I'm going for an expandable list: list items expands showing details.) Its all in the same form.
Like this:<h:form id="deptYear"> <h:dataTable id="departmentListResults" width="100%" cellspacing="1" value="#{departmentList.resultList}" var="dept"> <h:column> <h:panelGrid columns="3" width="100%" cellspacing="0" cellpadding="0" columnClasses="deptClass1,deptClass2,deptClass3"> <a4j:commandButton id="expandList" title="Click here to open or close" reRender="expandList,gwz,projListResults" image="#{main.imageMap[dept]}" action="#{main.pressExpandButton(dept)}" > <a4j:ajaxListener type="org.ajax4jsf.ajax.ForceRender" /> </a4j:commandButton> <h:outputText value="#{dept.name}" styleClass="highlight"/> <h:outputText id="gwz" value="#{main.imageMap[dept]}"/> </h:panelGrid> <h:dataTable id="projListResults" width="100%" cellspacing="1" value="#{dept.projects}" var="proj" rendered="#{main.imageMap[dept]=='img/arrow_open.gif'}"> <h:column> <h3>Hey! #{main.imageMap[dept]}</h3> </h:column> </h:dataTable> </h:column> </h:dataTable> </h:form>
In this code the rerendered items on the detail line (the button image and gwz) both rerender just fine. My nested detail DataTable (projListResults) doesn't automatically rerender. Only if I it refresh on the browser to reload the whole page does it show the correct result.
I've tried using :deptYear:projListResults but that didn't work.
Any ideas? Thanks!
Greg -
3. Re: reRender Problem
gzoller Mar 12, 2007 11:59 AM (in response to wklaus)Ok, I have made some progress that allows this functionality to work, but mysteries remain.
Here's the working code:<h:form id="deptYear"> <h:dataTable id="departmentListResults" width="100%" cellspacing="1" value="#{departmentList.resultList}" var="dept"> <h:column> <h:panelGrid columns="3" width="100%" cellspacing="0" cellpadding="0" columnClasses="deptClass1,deptClass2,deptClass3"> <a4j:commandButton id="expandList" title="Click here to open or close" reRender="expandList,gwz,projListResults" image="#{main.imageMap[dept]}" action="#{main.pressExpandButton(dept)}" > <a4j:ajaxListener type="org.ajax4jsf.ajax.ForceRender" /> </a4j:commandButton> <h:outputText value="#{dept.name}" styleClass="highlight"/> <h:outputText id="gwz" value="#{main.imageMap[dept]}"/> </h:panelGrid> <a4j:region> <h:dataTable id="projListResults" width="100%" cellspacing="1" value="#{dept.projects}" var="proj"> <h:column> <h:outputText id="blah" rendered="#{main.imageMap[dept]=='img/arrow_open.gif'}" value="Hey! #{main.imageMap[dept]}"/> </h:column> </h:dataTable> </a4j:region> </h:column> </h:dataTable> </h:form>
I added an <a4j:region> around the nested DataTable. This allowed elements in this table to be rerendered from the a4j:commandButton in the parent table. That's good, but I had problems with getting rendered (not rerender) to work. I want to show or not show the detail panel based on the status of the expand button (a4j:commandButton).
If I added a render attribute w/boolean logic to either a4j:region, or the nested h:dataTable it was completely ignored. The detail table was always rendered. However if I add render attributes to elements within the nested h:dataTable the correct behavior happens: they render or not based on the boolean logic.
So why do I need to add boolean logic to every element in the nested table rather than just the table itself? That would be a whole lot easier. Is this a bug or reasonable and expected behavior?
Thanks,
Greg -
4. Re: reRender Problem
wklaus Mar 13, 2007 1:44 AM (in response to wklaus)Hi Sergey,
thanks for your hints. No the page works very well.
Regards
Wolfgang