diff --git a/Plan/src/main/java/com/djrapitops/plan/data/element/TableContainer.java b/Plan/src/main/java/com/djrapitops/plan/data/element/TableContainer.java index 6a3ced105..9a6be1dec 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/element/TableContainer.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/element/TableContainer.java @@ -21,6 +21,8 @@ public class TableContainer { private final String[] header; private List values; + private boolean jqueryDatatable; + private String color; /** @@ -43,7 +45,7 @@ public class TableContainer { } public final String parseHtml() { - return Html.TABLE_SCROLL.parse() + + return getTableHeader() + parseHeader() + parseBody() + ""; @@ -85,4 +87,21 @@ public class TableContainer { header.append(""); return header.toString(); } + + /** + * Make use of JQuery Datatables plugin. + *

+ * If this is called, result of {@code parseHtml()} should be wrapped with {@code Html.PANEL.parse(Html.PANEL_BODY.parse(result))} + */ + public void useJqueryDataTables() { + this.jqueryDatatable = true; + } + + private String getTableHeader() { + if (jqueryDatatable) { + return "

" + Html.TABLE_JQUERY.parse() + "
"; + } else { + return Html.TABLE_SCROLL.parse(); + } + } } \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/Html.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/Html.java index 4752242d8..72b01ed68 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/Html.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/Html.java @@ -60,6 +60,7 @@ public enum Html { TABLE_END(""), TABLE(""), TABLE_SCROLL("
"), + TABLE_JQUERY("
"), TABLE_COLORED("
"), TABLE_HEAD("${0}"), TABLE_BODY("${0}"), diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/PlayersTableCreator.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/PlayersTableCreator.java index 8bdd9d3bc..bcde92aca 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/PlayersTableCreator.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/PlayersTableCreator.java @@ -66,11 +66,11 @@ public class PlayersTableCreator { html.append(Html.TABLELINE_PLAYERS.parse( Html.LINK_EXTERNAL.parse(PlanAPI.getInstance().getPlayerInspectPageLink(profile.getName()), profile.getName()), activityString, - String.valueOf(playtime), FormatUtils.formatTimeAmount(playtime), - String.valueOf(loginTimes), - String.valueOf(registered), FormatUtils.formatTimeStampYear(registered), - String.valueOf(lastSeen), lastSeen != 0 ? FormatUtils.formatTimeStamp(lastSeen) : "-", - String.valueOf(geoLocation) + playtime, FormatUtils.formatTimeAmount(playtime), + loginTimes, + registered, FormatUtils.formatTimeStampYear(registered), + lastSeen, lastSeen != 0 ? FormatUtils.formatTimeStamp(lastSeen) : "-", + geoLocation )); } catch (NullPointerException e) { if (Settings.DEV_MODE.isTrue()) {