SmartClient Version: v9.1p_2014-05-18/PowerEdition Deployment (built 2014-05-18)
Hi,
is ther a way to custom sort the groups in a ListGrid ? SortNormalizer won't work. Only SortSpecifier with SortDirection seems to change the order.
Hi,
is ther a way to custom sort the groups in a ListGrid ? SortNormalizer won't work. Only SortSpecifier with SortDirection seems to change the order.
Code:
caseListGrid = new ListGrid(); caseListGrid.setAutoFetchData(true); caseListGrid.setShowFilterEditor(true); caseListGrid.setDataFetchMode(FetchMode.LOCAL); caseListGrid.setAlign(VerticalAlignment.CENTER); caseListGrid.setHeaderHeight(45); ListGridField name = new ListGridField(CaseModel.NAME, "Name"); name.setAlign(Alignment.LEFT); ListGridField manager = new ListGridField(CaseModel.MANAGER, "Manager"); manager.setAlign(Alignment.CENTER); ListGridField openDate = new ListGridField(CaseModel.OPEN_DATE, "Open date", 90); openDate.setAlign(Alignment.CENTER); //ListGridField archiveDate = new ListGridField(CasesDS._archiveDate, "Archive Date"); ListGridField closeDate = new ListGridField(CaseModel.CLOSE_DATE, "Close date", 90); closeDate.setAlign(Alignment.CENTER); ListGridField numberOfDocs = new ListGridField(CaseModel.NUM_OF_DOC, "No. of entries", NUMBER_VALUE_CLUMND_WIDTH); numberOfDocs.setWrap(true); numberOfDocs.setAlign(Alignment.CENTER); ListGridField documentDateRange = new ListGridField(CaseModel.DOC_DATE_RANGE, "Document date range"); documentDateRange.setAlign(Alignment.CENTER); ListGridField numOfQueries = new ListGridField(CaseModel.NUM_OF_QUERIES, "No. of Queries", NUMBER_VALUE_CLUMND_WIDTH); numOfQueries.setWrap(true); numOfQueries.setAlign(Alignment.CENTER); ListGridField internalExports = new ListGridField(CaseModel.INTERNAL_EXPORTS, "Internal Exports", NUMBER_VALUE_CLUMND_WIDTH); internalExports.setWrap(true); internalExports.setAlign(Alignment.CENTER); ListGridField numberOfAssignemtns = new ListGridField(CaseModel.NUM_OF_ASSIGNEMNTS, "No. of members", NUMBER_VALUE_CLUMND_WIDTH); numberOfAssignemtns.setWrap(true); numberOfAssignemtns.setAlign(Alignment.CENTER); ListGridField status = new ListGridField(CaseModel.CASE_STATUS_LABLE, "Status"); status.setSortNormalizer(new SortNormalizer() { @Override public Object normalize(ListGridRecord record, String fieldName) { //System.err.println(record.getAttribute(CasesDS.NAME) + record.getAttribute(CasesDS.CASE_STATUS)); String status = record.getAttribute(CaseModel.CASE_STATUS); if (status != null) { switch (CaseStatusC.valueOf(status)) { case NEW: return 5; case OPEN: return 4; case REOPENED: return 3; case DISCOVERY_CLOSED: return 2; case CLOSED: return 1; default: break; } } return 1; } }); status.setHidden(true); caseListGrid.setFields(name, manager, openDate, closeDate, numberOfDocs, documentDateRange, numOfQueries, internalExports, numberOfAssignemtns, status); caseListGrid.setInitialSort( new SortSpecifier(CaseModel.CASE_STATUS_LABLE, SortDirection.DESCENDING)); caseListGrid.setGroupStartOpen(GroupStartOpen.ALL); caseListGrid.setFilterLocalData(true); caseListGrid.groupBy(CaseModel.CASE_STATUS_LABLE);
Comment