Matthias Kahlau wrote:
Hi Volker!
many thanks for your help. The problem with the equal component ids in the
logging output was caused by using dataModel.setRowIndex() instead of
uiData.setRowIndex() to access a row object.
But why can't dataModel.setRowIndex() be used?
I have used dataModel.getRowData() successfully already, so why not
dataModel.setRowIndex()?
Because there is only one component, not one for each row. The UIData
component keeps partial "state" information for each row of the table.
When row X is selected, it shoves the state for that row into the
component (in particular, the submittedValue). It also updates the
component's id so that the component has a row-specific id, of form
"tablename:rownum:componentid". All this logic gets bypassed if you use
dataModel.setRowIndex instead of uidata.setRowIndex.
There is just one UIComponent, not one for each row! Thats the reason
why i don't think it could be usefull to have a component binding inside
of a dataTable. If you realy need to access the components i think its
easier to have the binding on the UIData, as you need to do
uidata.setRowIndex() to populate the values.
I need the component-binding to the inputText in the dataTable to add custom
error messages to the inputText in a custom validator. I can access the
clientId of the inputText needed for a component-specific error message by
using the component-binding. Do you see an alternative to the
component-binding? (What comes to my mind is traversing the component tree
instead.)
As noted above, the same component is used in each row, with its id
updated whenever the uidata.setRowIndex is called. I think binding
should be ok, but you need to be sure the component's id is set to
reflect the "row" it currently represents before registering the message.
Regards,
Simon