Preeti Singh
Preeti Singh

Reputation: 37

displaying the value of the p:dataTable cell on click event of the p:panelGrid using p:ajax

I have p:dataTable, inside column I have a panelGrid where i want the value of the ouputText on the click of the panelGrid without page refresh. The code is something like:

<p:column headerText="5/5" style="width:40px; font-size:9pt;">  
    <p:panelGrid>
        <p:ajax event="click" listener="#{myBean.showSelectedValue(row)}" update=":mainForm"/>
        <h:outputText value="#{row.value1}" />  
    </p:panelGrid>
</p:column> 
</p:dataTable>
<h:panelGrid id="ForecastChartTab"> 
    <h:outputText id="value1" value="#{myBean.showValue.value1}" />  
</h:panelGrid>

This is working, but the value is seen only on page refresh...! is something wrong here? :(

Upvotes: 0

Views: 1209

Answers (1)

Roy Bonilla
Roy Bonilla

Reputation: 11

If you need to update the table, you can use the following

update="@([id$=dtTableId])"

If you need to update the output text you need use the following

update="@([id$= value1])"

With this type of format @([id$= value1]), you can update another component out of the behavior of others.

Upvotes: 1

Related Questions