This discussion is archived
1 Reply Latest reply: Feb 4, 2013 11:22 PM by Frank Nimphius RSS

problem with getting actual value in Row row=iter.getCurrentRow();

grodno Newbie
Currently Being Moderated
hi,

the use case is as follows:
in master-details, on detail table there are 2 columns with checkbox and username.
when user clicks checks, the username text item is populated with current user value in respective row.


<af:column sortProperty="#{bindings.DcaRegisterLinesV1.hints.Selected.name}" filterable="true"
sortable="true" headerText="#{bindings.DcaRegisterLinesV1.hints.Selected.label}" id="c1"
width="30">
<af:selectBooleanCheckbox value="#{row.bindings.Selected.inputValue}"
label="#{row.bindings.Selected.label}" autoSubmit="true"
valueChangeListener="#{registerBean.socSelectedChangeListener}"
shortDesc="#{bindings.DcaRegisterLinesV1.hints.Selected.tooltip}" id="sbc1">
<!--af:setPropertyListener from="#{securityContext.userName}"
to="#{bindings.ProcessedUser.inputValue}"
type="attributeChange"/-->
</af:selectBooleanCheckbox>
</af:column>
<af:column headerText="#{bindings.DcaRegisterLinesV1.hints.ProcessedUser.label}" id="c17" width="80"
sortProperty="#{bindings.DcaRegisterLinesV1.hints.ProcessedUser.name}" filterable="true"
sortable="true">
<af:outputText value="#{row.ProcessedUser}" id="ot17"/>
</af:column>

the bean's code is below:


public void socSelectedChangeListener(ValueChangeEvent valueChangeEvent) {
BindingContainer dcbindings = getBindings();
AttributeBinding at;
DCBindingContainer dc=(DCBindingContainer) dcbindings;
DCIteratorBinding iter=dc.findIteratorBinding("DcaRegisterLinesV1Iterator");
BindingContext bindingctx = BindingContext.getCurrent();
BindingContainer bindings = (BindingContainer)bindingctx.getCurrentBindingsEntry();
Row row=iter.getCurrentRow();
String AgreementId=row.getAttribute("AgreementId").toString();
System.out.println(" AgreementId="+AgreementId);

it always prints the first row's values.
even though i click on different rows on the table prior clicking checkbox.
what's wrong? seems like the model is not refreshed because what? autosubmit=true ?..
how can i get the actual row values?
please help

the
  • 1. Re: problem with getting actual value in Row row=iter.getCurrentRow();
    Frank Nimphius Employee ACE
    Currently Being Moderated
    Hi,

    lets clean up your code first:
    public void socSelectedChangeListener(ValueChangeEvent valueChangeEvent) {
    
    BindingContainer dcbindings = getBindings();
    
    //AttributeBinding at;
    
    DCBindingContainer dc=(DCBindingContainer) dcbindings;
    DCIteratorBinding iter=dc.findIteratorBinding("DcaRegisterLinesV1Iterator");
    
    //BindingContext bindingctx = BindingContext.getCurrent();
    //BindingContainer bindings = (BindingContainer)bindingctx.getCurrentBindingsEntry();
    
    Row row=iter.getCurrentRow();
    String AgreementId=row.getAttribute("AgreementId").toString();
    
    System.out.println(" AgreementId="+AgreementId);
    No to the possible problem. Check if the table SelectListener is set. It should have an EL string that ends with ".makeCurrent". This however makes only sense for single row select cases.

    Frank

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points