[
https://issues.apache.org/jira/browse/MYFACES-1738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531596
]
Leonardo Uribe commented on MYFACES-1738:
-----------------------------------------
It's not a bug. UIData use the same components to render each row. It save just
some properties like value, submittedValue that are expected to change between
rows, because it's very inefficient to have different instances from components
by each row. It's logical that when you do this, all UIInputText components
that belongs to the table changes. I have probed the code that are of your
interest and JSF RI do the same as Myfaces.
Maybe you can do something store the state of this property on a bean like a
Map to save the style to make your code work.
> invokeOnComponent returns wrong reference for UIData children
> -------------------------------------------------------------
>
> Key: MYFACES-1738
> URL: https://issues.apache.org/jira/browse/MYFACES-1738
> Project: MyFaces Core
> Issue Type: Bug
> Components: JSR-252
> Affects Versions: 1.2.1-SNAPSHOT
> Reporter: Dominik Erni
>
> I generate a collection of inputText components at runtime with the dataTable
> tag.
> <h:dataTable value="#bean.dataList" var="item">
> <h:column>
> <h:inputText id="field1" value="#{bean.field1}/>"
> </h:column>
> </h:dataTable>
> this leads to 2 inputText components in my example with IDs:
> -
> viewPC_7_HDPVQ2N200O1802L2I1LG810G1_:PC_7_HDPVQ2N200O1802L2I1LG810G1__idJsp0:PC_7_HDPVQ2N200O1802L2I1LG810G1__idJsp40:0:field1
> -
> viewPC_7_HDPVQ2N200O1802L2I1LG810G1_:PC_7_HDPVQ2N200O1802L2I1LG810G1__idJsp0:PC_7_HDPVQ2N200O1802L2I1LG810G1__idJsp40:1:field1
> Then I would like to get a reference to one specific of these inputTextFields
> with root.invokeOnComponent like this:
> ContextCallback callback = new ContextCallback(){
> public void invokeContextCallback(FacesContext context,
> UIComponent target) {
> target.getAttributes().put("style", "background:" +
> ERROR_COLOR);
> }
> };
> invokeOnComponent(root, fc,
> "viewPC_7_HDPVQ2N200O1802L2I1LG810G1_:PC_7_HDPVQ2N200O1802L2I1LG810G1__idJsp0:PC_7_HDPVQ2N200O1802L2I1LG810G1__idJsp40:1:field1",
> callback);
> In this example, I would only expect the UIInputText component with the given
> clientId to change its color, but all dynamically created UIInputText
> components of this dataTable do so!
> Is this a bug or a side effect?
> I used the patch provided in MYFACES-1721!
> Cheers,
> Dominik
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.