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!

Enter the Dashboard Challenge and Watch the .conf24 Global Broadcast!

The Splunk Community Dashboard Challenge is still happening, and it's not too late to enter for the week of ...

Join Us at the Builder Bar at .conf24 – Empowering Innovation and Collaboration

What is the Builder Bar? The Builder Bar is more than just a place; it's a hub of creativity, collaboration, ...

Combine Multiline Logs into a Single Event with SOCK - a Guide for Advanced Users

This article is the continuation of the “Combine multiline logs into a single event with SOCK - a step-by-step ...