Skip to content

Commit d38925b

Browse files
Thomas PinetzManuel Geier
authored andcommitted
Add Sort for multiple Columns
1 parent e87dba2 commit d38925b

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/main/javascript/base/SearchRequest.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,16 @@ window.cat.SearchRequest = function (searchUrlParams) {
3939
}
4040

4141
var _encodeSort = function () {
42-
return (!!_sort.property ? 'sort=' + _sort.property + ':' + ((_sort.isDesc === true || _sort.isDesc === 'true') ? 'desc' : 'asc') : '');
42+
if(!!_sort.property) {
43+
var properties = _sort.property.split(';');
44+
var result = 'sort=';
45+
for(var i = 0; i< properties.length; i++) {
46+
result += properties[i] + ':' + ((_sort.isDesc === true || _sort.isDesc === 'true') ? 'desc' : 'asc') + ';';
47+
}
48+
return result.slice(0, -1);
49+
} else {
50+
return '';
51+
}
4352
};
4453

4554
var _encodePagination = function () {

src/main/javascript/service/cat-search-service.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,16 @@ angular.module('cat.service.search', [])
3939
.service('catSearchService', function ($location, catUrlEncodingService) {
4040

4141
var _encodeSort = function (_sort) {
42-
return (!!_sort.property ? 'sort=' + _sort.property + ':' + ((_sort.isDesc === true || _sort.isDesc === 'true') ? 'desc' : 'asc') : '');
42+
if(!!_sort.property) {
43+
var properties = _sort.property.split(';');
44+
var result = 'sort=';
45+
for(var i = 0; i< properties.length; i++) {
46+
result += properties[i] + ':' + ((_sort.isDesc === true || _sort.isDesc === 'true') ? 'desc' : 'asc') + ';';
47+
}
48+
return result.slice(0, -1);
49+
} else {
50+
return '';
51+
}
4352
};
4453

4554
var _encodePagination = function (_pagination) {

0 commit comments

Comments
 (0)