AW: AW: Problem with selectBooleanCheckbox inside dataTable
Hi Simon, thanks for your response. I use one UISelectBoolean component property in my Backing-Bean, which is bound to the selectBooleanCheckbox used in the dataTable. Because the dataTable has more than one row, that component or at least the reference must be shared by all rows internally. Sharing seems to be the source of the first problem, that all checkboxes are rendered as selected when the page is redisplayed after a postback where only the last checkbox was chosen. It seems that the checkboxes are rerendered with the selected state of the last checkbox processed (the checkbox of the last row), what can be prevented by programmatically modifying the selected state of the UISelectBoolean component in the postback. And this solution also solved the second problem (runtime error), that arised when I tried to delete all rows after the page had been redisplayed with all checkboxes selected. The table used in the validation phase must have become out of sync with the data rendered previously. But I can't reproduce the error in the moment. Regards, Matthias -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Auftrag von Simon Kitching Gesendet: Dienstag, 6. Dezember 2005 23:19 An: MyFaces Discussion Betreff: Re: AW: Problem with selectBooleanCheckbox inside dataTable Hi, When a table contains editable components, the value list is fetched at the following times: (initial page view occurs) * during the rendering phase (postback occurs) * during validation phase (navigate occurs, ie internal forward) * during the rendering phase The data is needed at the validation phase in order to determine whether ValueChangeEvent events should be queued. The same list is retained by the UIData and used during the update-model phase when the validated values are pushed to the backing objects from the value list. A new list must be fetched before rendering, however, as the list may change as a result of processing during update-model or invoke-application phases. When a table contains editable components, the table fetched during the validation phase must contain exactly the same elements (and in exactly the same order) as was present during the previous rendering phase. If this isn't true then all sorts of confusion can occur. Are your checkbox components bound to some backing list whose size has changed? I can't see why that would happen, but it would explain some of your symptoms. The table is iterating through all its rows, fetching the corresponding element from the value list for that row, and then trying to determine whether the submitted value is different from the value of the corresponding model object. If the list is too short, then of course an exception will occur while trying to fetch the matching model object. Regards, Simon Matthias Kahlau wrote: Hi! Ok, it seems that the rendering behavior of the selectBooleanCheckbox (with immediate = false) inside a dataTable is how to expect from an EditableValueHolder, and I have to call either setSubmittedValue(null) or setSelectedState(false) to prevent the checkboxes from beeing selected if the page is redisplayed, dependent on the immediate state of the commandButton: - setSubmittedValue(null) if commandButton is immediate = true - submitted value is rendered if not null - setSelectedState(false) if commandButton is immediate = false But what I don't really understand is, why the problem described (all checkboxes are selected when the page is redisplayed, and runtime error after deleting this selection) only happens when the checkbox of the last shown row has been selected, and not when any other checkbox had been selected. Any ideas? Regards, Matthias -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Auftrag von Matthias Kahlau Gesendet: Dienstag, 6. Dezember 2005 02:47 An: Users MyFaces Betreff: Problem with selectBooleanCheckbox inside dataTable Hi! I encounter a strange behavior of selectBooleanCheckbox component-binding inside a dataTable. When I select the checkbox in the last row and call an action method to delete the selected row, the page is redisplayed with all the remaining checkboxes selected, that had been deselected before. This happens only if I select the last row/checkbox, not if I select another row and press delete. I don't modify any component state in the application. This behavior is independent of setting the selectBooleanCheckbox or the delete commandButton to false/true. The behavior described doesn't happen in any possible case, but always when the options are shown the first time and I select the last one and press delete. If this happens, and the checkboxes are all redisplayed in selected state, and I press delete, a runtime error is thrown because a row is unavailable: 02:36:22,218 ERROR
AW: Problem with selectBooleanCheckbox inside dataTable
Hi! Ok, it seems that the rendering behavior of the selectBooleanCheckbox (with immediate = false) inside a dataTable is how to expect from an EditableValueHolder, and I have to call either setSubmittedValue(null) or setSelectedState(false) to prevent the checkboxes from beeing selected if the page is redisplayed, dependent on the immediate state of the commandButton: - setSubmittedValue(null) if commandButton is immediate = true - submitted value is rendered if not null - setSelectedState(false) if commandButton is immediate = false But what I don't really understand is, why the problem described (all checkboxes are selected when the page is redisplayed, and runtime error after deleting this selection) only happens when the checkbox of the last shown row has been selected, and not when any other checkbox had been selected. Any ideas? Regards, Matthias -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Auftrag von Matthias Kahlau Gesendet: Dienstag, 6. Dezember 2005 02:47 An: Users MyFaces Betreff: Problem with selectBooleanCheckbox inside dataTable Hi! I encounter a strange behavior of selectBooleanCheckbox component-binding inside a dataTable. When I select the checkbox in the last row and call an action method to delete the selected row, the page is redisplayed with all the remaining checkboxes selected, that had been deselected before. This happens only if I select the last row/checkbox, not if I select another row and press delete. I don't modify any component state in the application. This behavior is independent of setting the selectBooleanCheckbox or the delete commandButton to false/true. The behavior described doesn't happen in any possible case, but always when the options are shown the first time and I select the last one and press delete. If this happens, and the checkboxes are all redisplayed in selected state, and I press delete, a runtime error is thrown because a row is unavailable: 02:36:22,218 ERROR [Engine] StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception javax.faces.FacesException: Error calling action method of component with id _id1:_id34 at org.apache.myfaces.application.ActionListenerImpl.processAction(Ac tionListen erImpl.java:74) at javax.faces.component.UICommand.broadcast(UICommand.java:106) at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90) at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:132) at org.apache.myfaces.lifecycle.LifecycleImpl.applyRequestValues(Life cycleImpl. java:219) at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:71) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(A pplication FilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicati onFilterCh ain.java:157) at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(E xtensionsF ilter.java:123) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(A pplication FilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicati onFilterCh ain.java:157) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeade rFilter.ja va:75) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(A pplication FilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicati onFilterCh ain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapp erValve.ja va:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardV alveContex t.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline. java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(Stand ardContext Valve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardConte xtValve.ja va:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardV alveContex t.java:104) at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPr incipalVal ve.java:66) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardV alveContex t.java:102) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Secu rityAssoci ationValve.java:150) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardV alveContex t.java:102) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextV alve.java: 54) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardV alveContex t.java:102) at
Re: AW: Problem with selectBooleanCheckbox inside dataTable
Hi, When a table contains editable components, the value list is fetched at the following times: (initial page view occurs) * during the rendering phase (postback occurs) * during validation phase (navigate occurs, ie internal forward) * during the rendering phase The data is needed at the validation phase in order to determine whether ValueChangeEvent events should be queued. The same list is retained by the UIData and used during the update-model phase when the validated values are pushed to the backing objects from the value list. A new list must be fetched before rendering, however, as the list may change as a result of processing during update-model or invoke-application phases. When a table contains editable components, the table fetched during the validation phase must contain exactly the same elements (and in exactly the same order) as was present during the previous rendering phase. If this isn't true then all sorts of confusion can occur. Are your checkbox components bound to some backing list whose size has changed? I can't see why that would happen, but it would explain some of your symptoms. The table is iterating through all its rows, fetching the corresponding element from the value list for that row, and then trying to determine whether the submitted value is different from the value of the corresponding model object. If the list is too short, then of course an exception will occur while trying to fetch the matching model object. Regards, Simon Matthias Kahlau wrote: Hi! Ok, it seems that the rendering behavior of the selectBooleanCheckbox (with immediate = false) inside a dataTable is how to expect from an EditableValueHolder, and I have to call either setSubmittedValue(null) or setSelectedState(false) to prevent the checkboxes from beeing selected if the page is redisplayed, dependent on the immediate state of the commandButton: - setSubmittedValue(null) if commandButton is immediate = true - submitted value is rendered if not null - setSelectedState(false) if commandButton is immediate = false But what I don't really understand is, why the problem described (all checkboxes are selected when the page is redisplayed, and runtime error after deleting this selection) only happens when the checkbox of the last shown row has been selected, and not when any other checkbox had been selected. Any ideas? Regards, Matthias -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Auftrag von Matthias Kahlau Gesendet: Dienstag, 6. Dezember 2005 02:47 An: Users MyFaces Betreff: Problem with selectBooleanCheckbox inside dataTable Hi! I encounter a strange behavior of selectBooleanCheckbox component-binding inside a dataTable. When I select the checkbox in the last row and call an action method to delete the selected row, the page is redisplayed with all the remaining checkboxes selected, that had been deselected before. This happens only if I select the last row/checkbox, not if I select another row and press delete. I don't modify any component state in the application. This behavior is independent of setting the selectBooleanCheckbox or the delete commandButton to false/true. The behavior described doesn't happen in any possible case, but always when the options are shown the first time and I select the last one and press delete. If this happens, and the checkboxes are all redisplayed in selected state, and I press delete, a runtime error is thrown because a row is unavailable: 02:36:22,218 ERROR [Engine] StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception javax.faces.FacesException: Error calling action method of component with id _id1:_id34 at org.apache.myfaces.application.ActionListenerImpl.processAction(Ac tionListen erImpl.java:74) at javax.faces.component.UICommand.broadcast(UICommand.java:106) at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90) at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:132) at org.apache.myfaces.lifecycle.LifecycleImpl.applyRequestValues(Life cycleImpl. java:219) at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:71) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(A pplication FilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicati onFilterCh ain.java:157) at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(E xtensionsF ilter.java:123) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(A pplication FilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicati onFilterCh ain.java:157) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeade rFilter.ja va:75) at