Sorting on name now works in the statistics panel (for the spring data api).
This commit is contained in:
parent
a2eb60184b
commit
4403257d16
@ -1,5 +1,6 @@
|
||||
package se.su.dsv.scipro.admin.panels.match;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||
@ -59,12 +60,12 @@ public class AdminSupervisorKeywordPanel extends Panel {
|
||||
if(!supervisorName.toString().isEmpty()) {
|
||||
String addToSearch = "true";
|
||||
}
|
||||
if (sortDirection.toString().isEmpty() || sortDirection.toString().equals("DESC")) {
|
||||
sortDirection.delete(0, sortDirection.length());
|
||||
sortDirection.append("ASC");
|
||||
} else {
|
||||
if (sortDirection.toString().isEmpty() || sortDirection.toString().equals("ASC")) {
|
||||
sortDirection.delete(0, sortDirection.length());
|
||||
sortDirection.append("DESC");
|
||||
} else {
|
||||
sortDirection.delete(0, sortDirection.length());
|
||||
sortDirection.append("ASC");
|
||||
}
|
||||
orderBy__.delete(0, orderBy__.length());
|
||||
orderBy__.append(orderBy);
|
||||
@ -82,13 +83,24 @@ if(!supervisorName.toString().isEmpty()) {
|
||||
org.springframework.data.domain.Sort sorter;
|
||||
if (sortDirection.toString().isEmpty()) {
|
||||
sorter = new org.springframework.data.domain.Sort(org.springframework.data.domain.Sort.Direction.ASC, "user.lastName");
|
||||
}
|
||||
else if (sortDirection.toString().equals("ASC")) {
|
||||
} else if (sortDirection.toString().equals("ASC")) {
|
||||
sorter = new org.springframework.data.domain.Sort(org.springframework.data.domain.Sort.Direction.ASC, orderBy.toString());
|
||||
} else {
|
||||
sorter = new org.springframework.data.domain.Sort(org.springframework.data.domain.Sort.Direction.DESC, orderBy.toString());
|
||||
}
|
||||
return supervisorService.findAllEmployees(sorter);
|
||||
|
||||
List<Employee> employeeList = new ArrayList<Employee>();
|
||||
employeeList.addAll(supervisorService.findAllEmployees(sorter));
|
||||
if(!supervisorName.toString().isEmpty()) {
|
||||
List<Employee> employeeListName = new ArrayList<Employee>();
|
||||
for(Employee employee : employeeList) {
|
||||
if(employee.getNameAsString().equals(supervisorName.toString())) {
|
||||
employeeListName.add(employee);
|
||||
}
|
||||
}
|
||||
return employeeListName;
|
||||
}
|
||||
return employeeList;
|
||||
}
|
||||
}) {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user