From 439980b0eb18a004a2f97c7eaf8fcc6b65a67d16 Mon Sep 17 00:00:00 2001 From: parkera <parkera> Date: Fri, 11 Mar 2016 13:29:19 +0000 Subject: [PATCH] SSDM-3024 : Search call for samples (ongoing work) SVN: 35884 --- .../js/views/AdvancedSearch/AdvancedSearchView.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/AdvancedSearch/AdvancedSearchView.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/AdvancedSearch/AdvancedSearchView.js index a81b45283b9..185729a6795 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/AdvancedSearch/AdvancedSearchView.js +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/AdvancedSearch/AdvancedSearchView.js @@ -342,8 +342,9 @@ function AdvancedSearchView(advancedSearchController, advancedSearchModel) { }]; //Add properties as columns dynamically depending on the results - var foundPropertyCodes = {}; + //1. Get properties with actual data + var foundPropertyCodes = {}; for(var rIdx = 0; rIdx < results.objects.length; rIdx++) { var entity = results.objects[rIdx]; for(var propertyCode in entity.properties) { @@ -353,14 +354,22 @@ function AdvancedSearchView(advancedSearchController, advancedSearchModel) { } } + //2. Get columns + var propertyColumnsToSort = []; for(var propertyCode in foundPropertyCodes) { - columns.push({ + propertyColumnsToSort.push({ label : profile.getPropertyType(propertyCode).label, property : propertyCode, sortable : true }); } - // + + //3. Sort column properties by label + propertyColumnsToSort.sort(function(propertyA, propertyB) { + return propertyA.label.localeCompare(propertyB.label); + }); + columns = columns.concat(propertyColumnsToSort); + var getDataRows = function(callback) { var rows = []; -- GitLab