Okay. Complex Title for a simple(?) problem.
I have something like this going on (I made it as simple as possible here to illustrate)
<h:dataTable var="testVar" value="#{bean.VariablesArray}">
<h:inputText id="TestingID"
styleClass="propertyInput"
value="#{testVar.var1}"
disabled="#{testVar.var2 != false }"
readonly="#{testVar.var2 != false }" />
<h:selectBooleanCheckbox
value="#{testVar.var2}">
<a4j:support event="onclick" reRender="TestingID" />
</h:dataTable>
It doesn't work and i'm assuming because of two reasons related to the datatable:
The EL
"#{testVar.var2 != false }"
should have a better instance indicator.The
reRender="TestingID"
should be reffering to the correct instance of the inputText.
So my que开发者_如何学编程stion is how do I do this correctly?
Thanks!!!
According to the doc, reRender
takes the form used by UIComponent.findComponent(String) (that is, it uses the client identifier and not the component identifier).
There are a few ways to get this value (combinations of backing beans, static functions and/or component binding) but you'll end up with something like this:
<h:inputText id="TestingID" styleClass="propertyInput"
value="#{testVar.var1}" disabled="#{testVar.var2 != false }"
readonly="#{testVar.var2 != false }"
binding="#{someReqScopeMap.TestingID}" />
<h:selectBooleanCheckbox value="#{testVar.var2}">
<a4j:support event="onclick"
reRender="#{myfn:cid(someReqScopeMap.TestingID)}" />
See JSF: working with component identifiers (id/clientId) for more detail and sample code.
精彩评论