Even more Fixes over dashboard's sorting

This commit is contained in:
George Kalampokis 2021-10-12 18:06:14 +03:00
parent 6de12fd0e8
commit 1a821179db
1 changed files with 3 additions and 0 deletions

View File

@ -356,6 +356,9 @@ public class DashBoardManager {
try {
String order = tableRequest.getOrderings().getFields().get(0).toCharArray()[0] + "";
String field = tableRequest.getOrderings().getFields().get(0).substring(1);
if (field.contains(":") && field.contains("|")) {
field = field.substring(field.lastIndexOf(":") + 1, field.indexOf("|"));
}
field = field.equals("label") ? "title" : field;
field = field.substring(0, 1).toUpperCase() + field.substring(1);
return (order.equals("+") ? 1 : -1 ) * ((Comparable)o1.getClass().getMethod("get" + field).invoke(o1)).compareTo(o2.getClass().getMethod("get" + field).invoke(o2));