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!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...