if (dataModel instanceof ExtendedTableDataModifiableModel<?>) {
((ExtendedTableDataModifiableModel<?>) dataModel).setVar(getVar());
}
if ((filterFields != null && !filterFields.isEmpty())
|| (sortFields != null && !sortFields.isEmpty())) {
Modifiable modifiable = null;
if (dataModel instanceof Modifiable) {
modifiable = (Modifiable) dataModel;
} else if (dataModel instanceof ExtendedTableDataModel<?>) {
ExtendedTableDataModel<?> tableDataModel = (ExtendedTableDataModel<?>) dataModel;
//ExtendedTableDataModifiableModelOld<?> modifiableModel = new ExtendedTableDataModifiableModelOld(tableDataModel, getVar());
ExtendedTableDataModifiableModel<?> modifiableModel = new ExtendedTableDataModifiableModel(tableDataModel, getVar());
dataModel = modifiableModel;
modifiable = modifiableModel;
}
else {
ModifiableModel modifiableModel = new ModifiableModel(dataModel, getVar());
dataModel = modifiableModel;
modifiable = modifiableModel;
}
if (dataModel instanceof LocaleAware) {
FacesContext facesContext = getFacesContext();
if (ContextInitParameters.isDatatableUsesViewLocale(facesContext)) {
UIViewRoot viewRoot = facesContext.getViewRoot();
((LocaleAware) dataModel).setLocale(viewRoot.getLocale());
}
}
modifiable.modify(filterFields, sortFields);
}
return dataModel;
}