@Override protected void onGrdDetailsGridHeaderClicked(int column) throws PresentationLogicException { if (column == 8) { if (form.getLocalContext().getSortOrder() == null) { form.getLocalContext().setSortOrder(SortOrder.ASCENDING); } PatientCustomItemVoCollection voColl = form.grdDetails().getValues(); voColl.sort(PatientCustomItemVo.getDateTimeComparator(form.getLocalContext().getSortOrder())); if (form.getLocalContext().getSortOrder().equals(SortOrder.ASCENDING)) form.getLocalContext().setSortOrder(SortOrder.DESCENDING); else if (form.getLocalContext().getSortOrder().equals(SortOrder.DESCENDING)) form.getLocalContext().setSortOrder(SortOrder.ASCENDING); form.grdDetails().getRows().clear(); populateGrid(voColl); } }
private void populateGrid(PatientCustomItemVoCollection listEntry) { for ( int i = 0 ; listEntry != null && i < listEntry.size() ; i++) { addGridRow(listEntry.get(i)); } }