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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...