public void encodeTableMenu(FacesContext context, UIExtendedDataTable table)
throws IOException {
AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
Object key = table.getRowKey();
table.setRowKey(null);
TableMenuRenderer menuRenderer = new RichTableMenuRenderer();
menuRenderer.setSortFunction(getSortFunction(context, table));
menuRenderer.setGroupFunction(getGroupFunction(context, table));
menuRenderer
.setChangeColumnVisibilityFunction(getChangeColumnVisibilityFunction(
context, table));
menuRenderer.setPrepareFunction(getPreSendAjaxRequestFunction(context,
table));
for (Iterator<UIColumn> colums = table.getSortedColumns(); colums
.hasNext();) {
UIColumn col = colums.next();
if (col instanceof UIColumn) {
UIColumn column = (UIColumn) col;
// if (column.isRendered()){
String menuId = menuRenderer.renderMenu(context, table, column);
ajaxContext.addRenderedArea(menuId);
// }
}
}// for
table.setRowKey(key);