I'm trying to implement lazy loading in an ace:dataTable. My web application has quite a lot of tables, so I've tried to reduce redundancy by using templates for the columns. Currently my tables look like this:
Datatable in my xhtml page
<ace:dataTable
id="produktdatenTabelle"
value="#{produktdatenBean.lazyModel}"
var="row"
rows="20"
paginator="true"
paginatorPosition="bottom"
paginatorAlwaysVisible="true"
lazy="true">
<ui:include src="/resources/aceDataTable/column.xhtml">
<ui:param name="title" value="ID" />
<ui:param name="value" value="#{row.id}" />
</ui:include>
<ui:include src="/resources/aceDataTable/column.xhtml">
<ui:param name="title" value="Description" />
<ui:param name="value" value="#{row.description}" />
</ui:include>
</ace:dataTable>
column.xhtml
<ui:composition>
<ace:column headerText="#{title}" sortBy="#{value}" filterBy="#{value}" filterMatchMode="contains">
<c:choose>
<!-- Editable -->
<c:when test="${editable == 'true'}">
<ace:cellEditor>
<f:facet name="output">
<h:outputText value="#{value}"/>
</f:facet>
<f:facet name="input">
<h:inputText value="#{value}" />
</f:facet>
</ace:cellEditor>
</c:when>
<!-- Not editable -->
<c:otherwise>
<h:outputText value="#{value}"/>
</c:otherwise>
</c:choose>
</ace:column>
</ui:composition>
Class of produktdatenBean.lazyModel
public class LazyDataModelImpl<D> extends LazyDataModel<D>
{
@Override
public List<D> load(int first, int pageSize, SortCriteria[] sortCriteria, Map<String, String> filters)
{
...
}
}
The parameters 'first' and 'pageSize' are passed correctly and I can use them, to load my object from the database. So everything working there. But now I'm trying to sort.
If I sort by the column ID, I get an object of SortCriteria in the array 'sortCriteria' (as expected). Unfortunately it has set its propertyName to '#{value' instead of 'id'. So parameters inside the template don't get resolved when passed to the load() method.
If remove the templates and change my table to
Datatable with templates removed
<ace:dataTable
id="produktdatenTabelle"
value="#{produktdatenBean.lazyModel}"
var="row"
rows="20"
paginator="true"
paginatorPosition="bottom"
paginatorAlwaysVisible="true"
lazy="true">
<ace:column headerText="ID" sortBy="#{row.id}" filterBy="#{row.id}" filterMatchMode="contains">
<h:outputText value="#{row.id}"/>
</ace:column>
<ace:column headerText="Description" sortBy="#{row.description}" filterBy="#{row.description}" filterMatchMode="contains">
<h:outputText value="#{row.description}"/>
</ace:column>
</ace:dataTable>
everything works as expected (the SortCriteria has set propertyName to 'id').
So my question is: Can I use templates with a lazy loading ace:dataTable or is this not supposed to work? If it is possible, what do I have to do to get the parameters passed correctly?