return getSortFunctionDef(context, table, null);
}
protected JSFunctionDefinition getSortFunctionDef(FacesContext context,
UIDataTable table, Boolean asc) {
JSFunctionDefinition definition = new JSFunctionDefinition();
definition.addParameter("event");
definition.addParameter("columnId");
definition.addParameter("ascending");
String id = table.getClientId(context);
Map<String, Object> eventOptions = AjaxRendererUtils.buildEventOptions(
context, table);
@SuppressWarnings("unchecked")
Map<String, Object> parameters = (Map<String, Object>) eventOptions
.get("parameters");
parameters.put(id, SORT_FILTER_PARAMETER);
// if (asc != null) {
// parameters.put(SORT_DIR_PARAMETER, asc ? SORT_DIR_PARAMETER_ASC
// : SORT_DIR_PARAMETER_DESC);
// }
// parameters.put(SORT_FILTER_PARAMETER, column.getClientId(context));
JSFunctionDefinition onAjaxCompleteFunction = getOnAjaxCompleteFunction(
context, table);
if (onAjaxCompleteFunction != null) {
eventOptions.put(AjaxRendererUtils.ONCOMPLETE_ATTR_NAME,
onAjaxCompleteFunction);
}