New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use saved ViewDataTable parameters mechanism for datatables displayed inside a widget container. #13088
Conversation
… inside a widget container.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work as expected. Left two minor comments...
@@ -116,7 +117,7 @@ public static function build($defaultType = null, $apiAction = false, $controlle | |||
if (!empty($report) && $controllerAction === $apiAction) { | |||
$paramsKey = $report->getId(); | |||
} | |||
$params = Manager::getViewDataTableParameters($login, $paramsKey); | |||
$params = Manager::getViewDataTableParameters($login, $paramsKey, $containerId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$containerId
might be undefined here, as it is set in an if condition
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guess the ,
in the end of the object list doesn't hurt, as we only support modern browsers...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will remove, force of habit.
Updated the PR |
… inside a widget container. (matomo-org#13088) * Use saved ViewDataTable parameters mechanism for datatables displayed inside a widget container. * apply PR feedback
Hi! @sgiehl @diosmosis When entering to, for example, Visitors -> Devices, and changing the visualization of the Device type (any report, actually) report to a vertical bar graph, and then selecting any metric, one request is being made: With the following response:
I tried the same in the Matomo Demo and the response received is this one:
I'm guessing the metric(s) selected can't be persisted, and it's ok, but why creating an error and leaving it in the Apache log? If it's supposed to be expected behavior. Thank you very much! |
Changes:
containerId
parameter sent by widget containers when getting child widgets. If found in a request, ViewDataTable will look for persisted ViewDataTable parameters.containerId
is appended to the option name for persisted parameters when present. This separates reports used within widget containers from the same reports used outside of widget containers. So if a user adds a metric to theVisits Overview (with graph)
, the change won't affect theVisitors > Overview
page.CoreHome.saveViewDataTableParameters
when a report is either not in a widget (as before), or is in a widget but is in a widget container (new).Fixes #11499