diff --git a/core/ViewDataTable/HtmlTable.php b/core/ViewDataTable/HtmlTable.php index adf4a13ad1d0d0a72c35bdc70158eb0042b762e7..ae24ec692abcf739d6c9522d49b28be8f1653438 100644 --- a/core/ViewDataTable/HtmlTable.php +++ b/core/ViewDataTable/HtmlTable.php @@ -56,6 +56,8 @@ class Piwik_ViewDataTable_HtmlTable extends Piwik_ViewDataTable $this->setLimit(Piwik_Config::getInstance()->General['datatable_default_limit']); $this->handleLowPopulation(); $this->setSubtableTemplate("@CoreHome/_dataTable.twig"); + $this->viewProperties['datatable_js_type'] = 'dataTable'; + $this->viewProperties['datatable_css_class'] = $this->getDefaultDataTableCssClass(); } protected function getViewDataTableId() @@ -91,19 +93,19 @@ class Piwik_ViewDataTable_HtmlTable extends Piwik_ViewDataTable $this->view = $this->buildView(); } - public function getDefaultDataTableType() + public function getDefaultDataTableCssClass() { return 'dataTableNormal'; } - public function setDataTableType($type) + public function setDataTableCssClass($type) { - $this->viewProperties['dataTableType'] = $type; + $this->viewProperties['datatable_css_class'] = $type; } public function setJsType($type) { - $this->dataTableJsType = $type; + $this->viewProperties['datatable_js_type'] = $type; } public function setSubtableTemplate($subtableTemplate) @@ -121,16 +123,8 @@ class Piwik_ViewDataTable_HtmlTable extends Piwik_ViewDataTable */ protected function buildView() { - if (empty($this->viewProperties['dataTableType'])) { - $this->viewProperties['dataTableType'] = $this->getDefaultDataTableType(); - } - $template = $this->idSubtable ? $this->viewProperties['subtable_template'] : $this->dataTableTemplate; $view = new Piwik_View($template); - - if (!empty($this->dataTableJsType)) { - $view->dataTableJsType = $this->dataTableJsType; - } if (!empty($this->loadingError)) { $view->error = $this->loadingError; diff --git a/core/ViewDataTable/HtmlTable/AllColumns.php b/core/ViewDataTable/HtmlTable/AllColumns.php index d486fcfc51e547357a71e75e85e6385ef0829f17..3381c8589128ac4b43bc4d505bba0ad903ddbf06 100644 --- a/core/ViewDataTable/HtmlTable/AllColumns.php +++ b/core/ViewDataTable/HtmlTable/AllColumns.php @@ -63,7 +63,7 @@ class Piwik_ViewDataTable_HtmlTable_AllColumns extends Piwik_ViewDataTable_HtmlT return true; } - public function getDefaultDataTableType() + public function getDefaultDataTableCssClass() { return 'dataTableAllColumns'; } diff --git a/core/ViewDataTable/HtmlTable/Goals.php b/core/ViewDataTable/HtmlTable/Goals.php index e938771d6070572860a9be6b9ecbeef6524e7548..7b407e8d171571c9b91d85fe6044b6c6d5a30c74 100644 --- a/core/ViewDataTable/HtmlTable/Goals.php +++ b/core/ViewDataTable/HtmlTable/Goals.php @@ -257,7 +257,7 @@ class Piwik_ViewDataTable_HtmlTable_Goals extends Piwik_ViewDataTable_HtmlTable return true; } - public function getDefaultDataTableType() + public function getDefaultDataTableCssClass() { return 'dataTableGoals'; } diff --git a/plugins/Actions/Controller.php b/plugins/Actions/Controller.php index 4980cd7764c92f83eda9549b1eea9a93f9053ec2..1b0cd2b15575b9716eccb071187674f9630b5cee 100644 --- a/plugins/Actions/Controller.php +++ b/plugins/Actions/Controller.php @@ -452,7 +452,7 @@ class Piwik_Actions_Controller extends Piwik_Controller */ protected function configureGenericViewActions($view) { - $view->setDataTableType('dataTableActions'); + $view->setDataTableCssClass('dataTableActions'); $view->setJsType('actionDataTable'); $view->setSubtableTemplate('@CoreHome/_dataTableActions_subDataTable.twig'); diff --git a/plugins/CoreHome/templates/_dataTable.twig b/plugins/CoreHome/templates/_dataTable.twig index 27ace4d782b8faddf89dd179038315651e0b5f50..d6b51d34f15aa56aca927a89aca2f7ad7d38969e 100644 --- a/plugins/CoreHome/templates/_dataTable.twig +++ b/plugins/CoreHome/templates/_dataTable.twig @@ -1,6 +1,6 @@ {% set isSubtable = javascriptVariablesToSet.idSubtable is defined and javascriptVariablesToSet.idSubtable != 0 %} -<div class="dataTable {{ properties.dataTableType }} {% if isSubtable %}subDataTable{% endif %}" - data-table-type="{{ dataTableJsType|default('dataTable') }}" +<div class="dataTable {{ properties.datatable_css_class }} {% if isSubtable %}subDataTable{% endif %}" + data-table-type="{{ properties.datatable_js_type|default('dataTable') }}" data-report="{{ properties.report_id }}" data-params="{{ javascriptVariablesToSet|json_encode }}"> <div class="reportDocumentation">