mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-25 10:37:51 +01:00
Fixed litebans table breaking the server page #636
This commit is contained in:
parent
403503e61f
commit
0661c0b1bd
@ -24,7 +24,7 @@ public class TableContainer {
|
||||
protected final Formatter[] formatters;
|
||||
private List<Serializable[]> values;
|
||||
|
||||
private boolean jqueryDatatable;
|
||||
private String jqueryDatatable;
|
||||
|
||||
private String color;
|
||||
|
||||
@ -56,7 +56,7 @@ public class TableContainer {
|
||||
return getTableHeader() +
|
||||
parseHeader() +
|
||||
parseBody() +
|
||||
"</table>" + (jqueryDatatable ? "</div>" : "");
|
||||
"</table>" + (jqueryDatatable != null ? "</div>" : "");
|
||||
}
|
||||
|
||||
public final String parseBody() {
|
||||
@ -112,17 +112,28 @@ public class TableContainer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Make use of JQuery Datatables plugin.
|
||||
* Make use of jQuery Data-tables plugin.
|
||||
* <p>
|
||||
* Use this with custom tables.
|
||||
* <p>
|
||||
* 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;
|
||||
this.jqueryDatatable = "player-plugin-table";
|
||||
}
|
||||
|
||||
/**
|
||||
* Make use of jQuery Data-tables plugin.
|
||||
*
|
||||
* @param sortType "player-table" or "player-plugin-table"
|
||||
*/
|
||||
public void useJqueryDataTables(String sortType) {
|
||||
jqueryDatatable = sortType;
|
||||
}
|
||||
|
||||
private String getTableHeader() {
|
||||
if (jqueryDatatable) {
|
||||
return "<div class=\"table-responsive\">" + Html.TABLE_JQUERY.parse();
|
||||
if (jqueryDatatable != null) {
|
||||
return "<div class=\"table-responsive\">" + Html.TABLE_JQUERY.parse(jqueryDatatable);
|
||||
} else {
|
||||
return Html.TABLE_SCROLL.parse();
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public enum Html {
|
||||
TABLE_END("</tbody></table>"),
|
||||
TABLE("<table class=\"table table-striped\">"),
|
||||
TABLE_SCROLL("<table class=\"table table-striped scrollbar\">"),
|
||||
TABLE_JQUERY("<table class=\"table table-bordered table-striped table-hover player-table dataTable\">"),
|
||||
TABLE_JQUERY("<table class=\"table table-bordered table-striped table-hover ${0} dataTable\">"),
|
||||
TABLE_COLORED("<table class=\"bg-${0} table table-striped\">"),
|
||||
TABLE_HEAD("<thead>${0}</thead>"),
|
||||
TABLE_BODY("<tbody>${0}</tbody>"),
|
||||
|
@ -39,7 +39,7 @@ public class PlayersTable extends TableContainer {
|
||||
);
|
||||
this.players = players;
|
||||
this.maxPlayers = maxPlayers;
|
||||
useJqueryDataTables();
|
||||
useJqueryDataTables("player-table");
|
||||
|
||||
setFormatter(2, Formatters.timeAmount());
|
||||
setFormatter(4, Formatters.yearLongValue());
|
||||
|
@ -32,7 +32,7 @@ public class PluginPlayersTable extends TableContainer {
|
||||
|
||||
this.players = players;
|
||||
|
||||
useJqueryDataTables();
|
||||
useJqueryDataTables("player-plugin-table");
|
||||
|
||||
if (players.isEmpty()) {
|
||||
addRow("No Players");
|
||||
@ -42,11 +42,6 @@ public class PluginPlayersTable extends TableContainer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String parseHtml() {
|
||||
return super.parseHtml().replace("player-table", "player-plugin-table");
|
||||
}
|
||||
|
||||
private static String[] getHeaders(Set<String> columnNames) {
|
||||
List<String> header = new ArrayList<>(columnNames);
|
||||
Collections.sort(header);
|
||||
|
@ -864,7 +864,7 @@
|
||||
<!-- Plan laod script -->
|
||||
<script>
|
||||
$(function () {
|
||||
$('.player-table').DataTable({
|
||||
$('.player-plugin-table').DataTable({
|
||||
responsive: true
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user