Dashboards & Visualizations

Why does the print dialog launches unexpectedly after printing?

davefarmersplun
New Member

I am a newbie to Splunk, and am doing maintenance on some legacy code and I noticed that whenever I refresh the dashboard after having printed, the print dialog will re-launch unexpectedly.

The code for printing hooks the dashboard click event for the Splunk print icon:

    $("#dashboard").on("click", "#print", function(e){

Then the click-event code creates a window, populates it with the contents that will be printed, and then launches the print dialog:

                    var win = window.open("", "_blank");
                    win.document.write($("head").html());

                    //create css element
                    var css = document.createElement("STYLE");
                    css.appendChild(document.createTextNode('th{background-color:#e6e6e6;} tr:nth-child(odd){background-color:#d5e2e9;} td{border: 1px solid #e8eef4;padding: 5px;}'));
                    win.document.write(css.outerHTML);

                    //create table and 
                    win.document.write(str.outerHTML);
                    win.document.close();
                    win.print();

So the question is "why does the print dialog get relaunched?. Is there an issue with tokens? Note that the click event code is not re-entered for this scenario. The print dialog (which becomes a new tab) is recreated, but not by the code.

I hope you can help.

Tags (3)
0 Karma

davefarmersplun
New Member

The version of Splunk used is 6.5.2.

Additionally, the dialog is re-displayed without entering the code that launches it. In other words, the dashboard "print" click is not fired.

0 Karma

niketn
Legend

@davefarmersplunk, which version of Splunk are you using? Under the Dashboard Export option, you should also have a built in option to Print the dashboard without having to depend on custom JavaScript.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...