Converter can't get rich:dataGrid rows as custom parameters

119 views Asked by At

I need a converter with custom parameters, I've made it and it works well, except when I use it with row elements and I can't understand why, ideas?

Examples

This works well:

<h:outputText value="#{bean.value}"> 
    <cc:converter param="#{bean.attribute}" />
</h:outputText>

also this one:

<h:outputText value="#{bean.value}"> 
    <cc:converter param="fixedValue" />
</h:outputText>

this one doesn't work at all, param is null inside the converter:

<rich:dataGrid value="#{bean.list}" var="row">
    <h:outputText value="#{row.value}"> 
        <cc:converter param="#{row.attribute}" />
    </h:outputText>
</rich:dataGrid>
1

There are 1 answers

1
Vasil Lukach On BEST ANSWER

See BalusC link. It describes why your converter doesn't work. Converter without parameters works fine inside datatable in JSF 1.2. For simulate conversion you can use getter method in object which represents row like getConvertedValue and move your code from converter into this method. After that in datatable you can call #{row.convertedValue} for displaying the converted value.