Dashboards & Visualizations

How to delete a rendered SplunkJS view?

bhawkins1
Communicator

Hi,

I have (for example) a ChartView created with const v = new ChartView({}).render();.

How can I delete/un-render v?

Regards,

0 Karma

Rocket66
Communicator

try:

splunkjs.mvc.Components.getInstance(id).remove();

where id is the object (eg. panel-id), you want to remove ...

example: splunkjs.mvc.Components.getInstance("element1").remove();

kalyangoutham
New Member

The remove function works fine. Can i recreate the chartview object that can be viewed upon creating it again with the same id:

require([
"splunkjs/mvc/tableview",
"splunkjs/mvc/chartview",
"splunkjs/mvc/searchmanager",
"splunkjs/mvc",
"splunkjs/mvc/postprocessmanager",
"splunkjs/mvc/dropdownview",
"splunkjs/mvc/multidropdownview",,
"splunkjs/mvc/textinputview",
"underscore",
"splunkjs/mvc/simplexml/ready!"
], function(
TableView,
ChartView,
SearchManager,
mvc,
PostProcessManager,
DropdownView,
MultiDropdownView,
TextInputView,
_
) {var chart = new ChartView ({
id: “element1”,
managerid: “managerid”,
wrap: true,
rowNumbers: false,
el: $("#elname")
}, {tokens: true}).render();})

When I try to recreate the ChartView component object on remove(), I am unable to view the chart on the Dashboard.
The above command ensures that the object is once again created and rendered.
Can you please suggest a way to recreate the removed Component that cab be viewed on the Dashboard

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 ...