1

Usig this element

<p:selectOneRadio id="selempaque" value="#{mbcompletado.empaque}">
    <f:selectItem itemLabel="Si" itemValue="true"/>
    <f:selectItem itemLabel="No" itemValue="false"/>
    <p:ajax update="colEmp"/>
</p:selectOneRadio>

I want to render a

<p:column id="colEmp" rendered="#{mbcompletado.empaque}"> .... </p:column>

But it does not change the render until I refresh the page. I want to use the Radio value to either show or hide the column.

Using primefaces and glassfish Thanks in advance

1 Answers1

1

JS/Ajax will only update elements which are already present in the HTML DOM tree. JS basically does first a document.getElementById(clientId) to obtain the to-be-updated element and then replaces the whole node with the new node retrieved from ajax response. JS/Ajax can't magically show/update elements which are never been rendered to the HTML output. You basically need to update a parent component which is always rendered and thus guaranteed to be present in the HTML DOM tree.

Assuming that the parent component is a <p:dataTable>,

<p:dataTable id="tableId" ...>

then you need to alter the update attribute accordingly:

<p:ajax update="tableId" />

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555