diff --git a/plugins/CoreHome/templates/datatable_footer.tpl b/plugins/CoreHome/templates/datatable_footer.tpl index 8aef75b99a818c39061cfd183136e79f79659607..c14230d866419dfac78491ca25811c1781a4869f 100644 --- a/plugins/CoreHome/templates/datatable_footer.tpl +++ b/plugins/CoreHome/templates/datatable_footer.tpl @@ -93,7 +93,7 @@ </span> {if $properties.show_export_as_image_icon} <span id="dataTableFooterExportAsImageIcon"> - <a class="tableIcon" href="#" onclick="$('#{$chartDivId}').trigger('piwikExportAsImage'); return false;"><img + <a class="tableIcon" href="#" onclick="$(this).closest('.dataTable').find('div.jqplot-target').trigger('piwikExportAsImage'); return false;"><img title="{'General_ExportAsImage_js'|translate}" src="themes/default/images/image.png"/></a> </span> {/if} diff --git a/plugins/CoreHome/templates/jqplot.js b/plugins/CoreHome/templates/jqplot.js index b1d54041075ddbcd82dda8c2fe46bf4a662fba96..e188c4e02387299a41d279e12d62b910b632978e 100644 --- a/plugins/CoreHome/templates/jqplot.js +++ b/plugins/CoreHome/templates/jqplot.js @@ -299,20 +299,27 @@ JQPlot.prototype = { height: exportCanvas.height + 'px' }); - $(document.createElement('div')) - .append('<div style="font-size: 13px; margin-bottom: 10px;">' - + lang.exportText + '</div>').append($(img)) - .dialog({ - title: lang.exportTitle, - modal: true, - width: 'auto', - position: ['center', 'center'], - resizable: false, - autoOpen: true, - close: function (event, ui) { - $(this).dialog("destroy").remove(); - } - }); + var popover = $(document.createElement('div')); + + popover.append('<div style="font-size: 13px; margin-bottom: 10px;">' + + lang.exportText + '</div>').append($(img)) + + popover.dialog({ + title: lang.exportTitle, + modal: true, + width: 'auto', + position: ['center', 'center'], + resizable: false, + autoOpen: true, + open: function (event, ui) { + $('.ui-widget-overlay').on('click.popover', function () { + popover.dialog('close'); + }); + }, + close: function (event, ui) { + $(this).dialog("destroy").remove(); + } + }); },