I'm trying to create my own dataTable like the primefaces one. The problem is that cc.attrs.var
when used throws a IllegalArgumentException. So I'm wondering how I can have the var attribute like Primefaces.
<cc:interface>
<cc:attribute name="value"/>
<cc:attribute name="var"/>
<cc:attribute name="styleClass"/>
</cc:interface>
<cc:implementation>
<div>Previous</div>
<div>Next</div>
<h:dataTable value="#{cc.attrs.value}" var="#{cc.attrs.var}" styleClass="#{cc.attrs.styleClass}">
<ui:insert/>
</h:dataTable>
</cc:implementation>
As per the
UIData#setValueExpression()
javadoc, it's not allowed to have an EL expression invar
attribute.Your best bet is to create a backing component wherein you manually evaluate and set the
var
attribute of theUIData
component bound to<h:dataTable>
during thepostAddToView
event.Note that I fixed the
<ui:insert>
to be<cc:insertChildren>
. The<ui:insert>
can only be used in<ui:composition>
/<ui:decorate>
.See also: