In a f:attribute I use to calculate the value, but I see it is calculated only when it is called.
I need to specify the value using variable consumed during the visualization, so if it asks for the value not during the production of the component where the f:attribute refer, the value will be not correct.
I hope correctly specify my problem. How can I force the evaluation of attribute value?
Thanks if someone answer me!
The xhtml is:
<rich:scrollableDataTable
value="#{myBean.getScrollData(frm,sez)}"
var="eachRow"
rows="20"
>
<rich:columns value="#{sez.getElements()}" var="info"
index="index" sortable="false"
>
<h:inputText id="txtf#{info.getId()}" value="#{eachRow.data[info]}"
valueChangeListener="#{myBean.handle}"
>
<f:attribute name="xxx" value="#{eachRow.getId()}"/>
</h:inputText>
</rich:columns>
</rich:scrollableDataTable>
the myBean java is:
public void handle(ValueChangeEvent e){
Object value = e.getNewValue();
if ((value==null || value.equals("")) && e.getOldValue()==null) return;
String xxx = e.getComponent().getAttributes().get("xxx").toString();
System.out.println("handle("+xxx+","+value+")");
}
the ScrollData java is:
private String id="";
public String getId(){ return id;}
id is a property of ScrollData read from DB.
I see the xxx value is inspected only during post, so the eachRow is positioned on the last record of the table... and it's wrong.
This mechanism goes ok when not used in DataTable and I see the getId() method is called during the creation of the page (it's correct).