From 95c044afee0ce90431103e94e5b6fdd54b510756 Mon Sep 17 00:00:00 2001 From: Javier Moran Rua Date: Sat, 13 Oct 2012 17:36:43 +0200 Subject: [PATCH] Sort the list of resources and triggers the sort after refreshing it. FEA: ItEr77S10ResourceAllocationLoadInformation --- .../search/NewAllocationSelectorController.java | 11 +++++++++++ .../webapp/resources/search/allocation_selector.zul | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/resources/search/NewAllocationSelectorController.java b/libreplan-webapp/src/main/java/org/libreplan/web/resources/search/NewAllocationSelectorController.java index b766ea892..fc662fea6 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/web/resources/search/NewAllocationSelectorController.java +++ b/libreplan-webapp/src/main/java/org/libreplan/web/resources/search/NewAllocationSelectorController.java @@ -75,6 +75,7 @@ import org.zkoss.zul.Treecell; import org.zkoss.zul.Treeitem; import org.zkoss.zul.TreeitemRenderer; import org.zkoss.zul.Treerow; +import org.zkoss.zul.api.Listheader; /** * Controller for searching for {@link Resource}. @@ -287,6 +288,16 @@ public class NewAllocationSelectorController extends private void refreshListBoxResources( List resources) { listBoxResources.setModel(new SimpleListModel(resources)); + triggerSortListBoxResources(); + } + + private void triggerSortListBoxResources() { + for (Object child : listBoxResources.getListhead().getChildren()) { + final Listheader hd = (Listheader) child; + if (!"natural".equals(hd.getSortDirection())) { + hd.sort("ascending".equals(hd.getSortDirection()), true); + } + } } private void returnToSpecificDueToResourceSelection() { diff --git a/libreplan-webapp/src/main/webapp/resources/search/allocation_selector.zul b/libreplan-webapp/src/main/webapp/resources/search/allocation_selector.zul index 402056ebb..42f7798c0 100644 --- a/libreplan-webapp/src/main/webapp/resources/search/allocation_selector.zul +++ b/libreplan-webapp/src/main/webapp/resources/search/allocation_selector.zul @@ -78,7 +78,7 @@ + sort="auto" sortDirection="ascending"/>