JsfUtil.addErrorMessage(err_msg);
}
private void addLazyTablePanel (Application app)
{
DataTable table = (DataTable) app.createComponent(DataTable.COMPONENT_TYPE);
String tableId = table.getClientId();
/*
* Set variable name for generated table it constant
*/
table.setVar(TABLE_VAR);
table.setLazy(true);
table.setPaginator(true);
table.setPaginatorAlwaysVisible(false);
table.setStyle("width: 100%");
table.setSelectionMode("single");
table.setValueExpression("selection",
JsfUtil.getExpression(String.format (SELECTED_OBJECT, BEAN_NAME, CAR_SEL_OBJECT)));
table.setValueExpression("paginatorTemplate", JsfUtil.getExpression(PAGINATOR_TEMPLATE));
table.setValueExpression("rows", JsfUtil.getExpression(String.format(PAGE_ZIZE, BEAN_NAME)));
table.setValueExpression(JsfUtil.VALUE_NAME, JsfUtil.getExpression("#{" + BEAN_NAME + "." + LAZY_TABLE_MODEL + "}"));
/*
* Row select and unselect listeners is needed for properly work of selection events.
* By default these are empty functions
*/
table.setRowSelectListener(
JsfUtil.getMethodExpression (
String.format (ON_ROW_SELECT, BEAN_NAME),
null,
SelectEvent.class));
/*
* Unselect listener
*/
table.setRowUnselectListener(JsfUtil.getMethodExpression (
String.format (ON_ROW_UNSELECT, BEAN_NAME),
null,
UnselectEvent.class));
JsfUtil.addTableColumns("cars", table);