diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/config/DatatableConfig.java b/domino-ui/src/main/java/org/dominokit/domino/ui/config/DatatableConfig.java new file mode 100644 index 000000000..9f5847a89 --- /dev/null +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/config/DatatableConfig.java @@ -0,0 +1,7 @@ +package org.dominokit.domino.ui.config; + +public interface DatatableConfig extends ComponentConfig { + default boolean isRemoveSummaryRecordsForEmptyTable(){ + return false; + } +} diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/config/UIConfig.java b/domino-ui/src/main/java/org/dominokit/domino/ui/config/UIConfig.java index a39c60517..9f57d0f9d 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/config/UIConfig.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/config/UIConfig.java @@ -30,4 +30,6 @@ public interface UIConfig StepperConfig, CalendarConfig, TimePickerConfig, - DelayedActionConfig {} + DelayedActionConfig, + DatatableConfig { +} diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/datatable/plugins/summary/SummaryPlugin.java b/domino-ui/src/main/java/org/dominokit/domino/ui/datatable/plugins/summary/SummaryPlugin.java index af08cf30f..4974805b7 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/datatable/plugins/summary/SummaryPlugin.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/datatable/plugins/summary/SummaryPlugin.java @@ -51,7 +51,7 @@ public class SummaryPlugin private List> summaryRows = new ArrayList<>(); private DataTable dataTable; private TFootElement footer; - private SummaryPluginConfig config = new SummaryPluginConfig(); + private SummaryPluginConfig config = SummaryPluginConfig.of(); /** * Initializes the SummaryPlugin with the DataTable. @@ -118,7 +118,7 @@ public void handleEvent(TableEvent event) { @Override public SummaryPlugin setConfig(SummaryPluginConfig config) { if (isNull(config)) { - this.config = new SummaryPluginConfig(); + this.config = SummaryPluginConfig.of(); } else { this.config = config; } diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/datatable/plugins/summary/SummaryPluginConfig.java b/domino-ui/src/main/java/org/dominokit/domino/ui/datatable/plugins/summary/SummaryPluginConfig.java index cf848d7ba..60bfb3e98 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/datatable/plugins/summary/SummaryPluginConfig.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/datatable/plugins/summary/SummaryPluginConfig.java @@ -15,15 +15,29 @@ */ package org.dominokit.domino.ui.datatable.plugins.summary; +import org.dominokit.domino.ui.config.DatatableConfig; import org.dominokit.domino.ui.datatable.plugins.PluginConfig; +import org.dominokit.domino.ui.utils.DominoUIConfig; public class SummaryPluginConfig implements PluginConfig { - private boolean removeOnEmptyData = false; + private boolean removeOnEmptyData; + + public SummaryPluginConfig(boolean removeOnEmptyData) { + this.removeOnEmptyData = removeOnEmptyData; + } + + public static SummaryPluginConfig of(){ + return new SummaryPluginConfig(DominoUIConfig.CONFIG.getUIConfig().isRemoveSummaryRecordsForEmptyTable();); + } + + public static SummaryPluginConfig of(boolean removeOnEmptyData){ + return new SummaryPluginConfig(removeOnEmptyData); + } /** * @return boolean, true will cause the plugin to remove the summary records for empty data - * tables, false will keep them, default to false + * tables, false will keep them, default to {@link DatatableConfig#isRemoveSummaryRecordsForEmptyTable()} */ public boolean isRemoveOnEmptyData() { return removeOnEmptyData;