You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Marcus Büttner <mb...@buett.at> on 2010/07/06 13:27:08 UTC

Problem using input elements in a datatable

Hi,

I have a problem with input elements in an UIData (e.g. datatable).

Example code:

<h:dataTable value="#{myBean.valueList}" var="val">
  <h:column>
   <h:outputText value="#{val.description}"/>
  </h:column>
  <h:column>
    <h:selectBooleanCheckbox id="flag" value="#{val.flag}"/>
  </h:column>
</h:dataTable>
<h:commandButton/>

I want to fetch the values of the selectBooleanCheckbox in the second 
column. I've set a breakpoint to setSubmittedValue in UIInput and what 
happens:
1.) The components are restored in restore view phase
2.) The DebugPhaseListner does a visitTree wich calls the 
setSubmittedValue for my three checkboxes (3 lines in table) about 17 
times. The visitTree of UIData does a setRowIndex an there the 
restoreDescendantComponentState is called, which restores the State of 
my UIInput (checkbox) again.
3.) Then decode is proccessed. Here the setRowIndex is called again and 
also the restoreState of my checkbox is done. Now the Checkbox is 
decoded and the submittedValue is set correctly.
4.) The DebugPhaseListner does a visitTree in the same way like point 2. 
The problem is it does also the restoreState of my Checkboxes (because 
of setRowIndex and so on) and the submittedValues are lost.

Is there anything I did wrong?

I hope, someone can help.

Regards Marcus



Re: Problem using input elements in a datatable

Posted by Marcus Büttner <mb...@buett.at>.
Ok, I think I found the problem.

I created an Issue and attached a patch.
https://issues.apache.org/jira/browse/MYFACES-2788

Marcus

Marcus Büttner schrieb:
> Hi,
>
> I have a problem with input elements in an UIData (e.g. datatable).
>
> Example code:
>
> <h:dataTable value="#{myBean.valueList}" var="val">
>  <h:column>
>   <h:outputText value="#{val.description}"/>
>  </h:column>
>  <h:column>
>    <h:selectBooleanCheckbox id="flag" value="#{val.flag}"/>
>  </h:column>
> </h:dataTable>
> <h:commandButton/>
>
> I want to fetch the values of the selectBooleanCheckbox in the second 
> column. I've set a breakpoint to setSubmittedValue in UIInput and what 
> happens:
> 1.) The components are restored in restore view phase
> 2.) The DebugPhaseListner does a visitTree wich calls the 
> setSubmittedValue for my three checkboxes (3 lines in table) about 17 
> times. The visitTree of UIData does a setRowIndex an there the 
> restoreDescendantComponentState is called, which restores the State of 
> my UIInput (checkbox) again.
> 3.) Then decode is proccessed. Here the setRowIndex is called again 
> and also the restoreState of my checkbox is done. Now the Checkbox is 
> decoded and the submittedValue is set correctly.
> 4.) The DebugPhaseListner does a visitTree in the same way like point 
> 2. The problem is it does also the restoreState of my Checkboxes 
> (because of setRowIndex and so on) and the submittedValues are lost.
>
> Is there anything I did wrong?
>
> I hope, someone can help.
>
> Regards Marcus
>
>