a4j:commandButton reRendering rich:datatable

后端 未结 1 869
被撕碎了的回忆
被撕碎了的回忆 2021-01-18 22:06

My issue is that I am trying to have a column in my datatable show an outputtext by default, and replace that with an inputtext when the commandbutton is pressed. Have not f

相关标签:
1条回答
  • 2021-01-18 23:10

    You need to wrap both components in an <a4j:outputPanel id="myPanel" ajaxRendered="true"/>. The reason both components are failing to be reRendered is that the component you've set torendered="false" will not be sent to the browser on initial view rendering.

    <a4j:outputPanel id="myPanel" ajaxRendered="true">
    <h:outputText value="#{_yield.yfYield}" rendered="#{not yieldSearch.visible}"/>
    <h:inputText rendered="#{yieldSearch.visible}" />
    </a4j:outputPanel>
    

    The way ajax refreshes work is by using javascript to locate a clientId in the DOM tree to update with new markup, i.e. the component must already be in the DOM tree. Since you've set the rendered="false", the component was never in the DOM tree to start with. So on an ajax request, the browser doesn't know what you're talking about because it can't find the clientId to update.

    Using the outputPanel with ajaxRendered="true", you're refreshing the entire outputPanel, so the ajax refresh will update that component as a whole, with whatever you've nested within it

    0 讨论(0)
提交回复
热议问题