ajax update row while using the rowStyleClass of p:datatable

291 Views Asked by At

i have a p:datatable of 30 sets of rows with each row can have different colors(rowStyleClass) based on the values chose in one of the column with ajax update table.

however, this give me problem with unsaved values in other columns of input text where everytime i change the value ajax, the table gets repopulated thus resetting every field to the saved original values.

how do i update only the row, but also use the p:datatable rowStyleClass?

eg. of code

<p:datatable id="dtable" var="tbl" value="#{bean.list}" 
    rowStyleClass=" #{tbl.column.value eq 'a' ? 'yellowColored' : ''} 
                    #{tbl.column.value eq 'b' ? 'greenColored' : ''}
                    #{tbl.column.value eq 'c' ? 'kindaBlueColored' : ''}">

    <p:column id="column" > 
        <f:facet name="header">
            <h:outputText value="column" />
        </f:facet>
        <p:selectOneMenu id="selColumn" value="#{tbl.column}" var="t" >
            <p:ajax partialSubmit="true" event="change" process="@this" 
                update="tsheet" listener="#{bean.onTypeChange}" />
            <f:selectItems value="#{bean.typeList}" var="type" 
                itemValue="#{type}" itemLabel="#{type.description}" />
        </p:selectOneMenu>
    </p:column>
</p:datatable>
0

There are 0 best solutions below