diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2018-06-26 10:43:39 +0300 |
---|---|---|
committer | Stefan Giehl <stefan@piwik.org> | 2018-06-26 10:43:39 +0300 |
commit | d780a73c83a94d9c5a4c6edb60ffb0fe11419844 (patch) | |
tree | 2050554401280fefc7019458f7bb1d08a3ed11cb /plugins/CoreHome/javascripts/dataTable.js | |
parent | afcffaae6016e78c24c4de74242edde4b4f5fbd0 (diff) |
Use saved ViewDataTable parameters mechanism for datatables displayed inside a widget container. (#13088)
* Use saved ViewDataTable parameters mechanism for datatables displayed inside a widget container.
* apply PR feedback
Diffstat (limited to 'plugins/CoreHome/javascripts/dataTable.js')
-rw-r--r-- | plugins/CoreHome/javascripts/dataTable.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/CoreHome/javascripts/dataTable.js b/plugins/CoreHome/javascripts/dataTable.js index 0d813e91d4..103b9afb89 100644 --- a/plugins/CoreHome/javascripts/dataTable.js +++ b/plugins/CoreHome/javascripts/dataTable.js @@ -1338,22 +1338,25 @@ $.extend(DataTable.prototype, UIControl.prototype, { } }, - // Tell parent widget that the parameters of this table was updated, notifyWidgetParametersChange: function (domWidget, parameters) { - var widget = $(domWidget).closest('[widgetId]'); + var widget = $(domWidget).closest('[widgetId],[containerid]'); // trigger setParameters event on base element - if (widget && widget.length) { + // Tell parent widget that the parameters of this table were updated, but only if we're not part of a widget + // container. widget containers send ajax requests for each child widget, and the child widgets' parameters + // are not saved with the container widget. + if (widget && widget.length && widget[0].hasAttribute('widgetId')) { widget.trigger('setParameters', parameters); } else { - + var containerId = widget && widget.length ? widget.attr('containerid') : undefined; var reportId = $(domWidget).closest('[data-report]').attr('data-report'); var ajaxRequest = new ajaxHelper(); ajaxRequest.addParams({ module: 'CoreHome', action: 'saveViewDataTableParameters', - report_id: reportId + report_id: reportId, + containerId: containerId }, 'get'); ajaxRequest.withTokenInUrl(); ajaxRequest.addParams({ |