Amira
Amira

Reputation: 3270

using hashmap to retrieve datatable column value

I have a dataTable displaying data of type Action. I have a column named "Status" which will be set by the user. After setting this column I want to retrieve the value from a HashMap with Action class as key and the status as value.

How could I do it directly in the dataTable status column? I attempted the following:

<p:dataTable var="currentExecutedTestAction" value="#{projectCampaignManagementMB.currentExecutedTestActionList}">
    <p:column>  
        <f:facet name="header">  
            <h:outputText value="Status" />  
        </f:facet>  
        <h:outputText value="#{projectCampaignManagementMB.actionMap(currentExecutedTestAction,statusValue)}" /> 
    </p:column>
</p:dataTable>

Upvotes: 1

Views: 223

Answers (1)

Daniel
Daniel

Reputation: 37051

Just use the action as a key (I suppose that the action is some String/Integer etc that can be used as a key).

<h:outputText value="#{projectCampaignManagementMB.actionMap[action]}"/>

JSF will use the action as a key to get the value, and than after you will submit some new value it will use action again to set the new value.

Upvotes: 1

Related Questions