Dashboards & Visualizations

What Javascript framework is this line?

josefa123
Explorer
mvc.Components.get('highlight').getVisualization(function(tableView)

I've been searching a lot on where do I find this line of code on many frameworks but unfortunately I can't find any. Can you point me to the right direction? Because I really want to know what the code really does and I want to utilize it to what I want to do. Thank you so much. Any help would be appreciated.

0 Karma
1 Solution

jeffland
SplunkTrust
SplunkTrust

Unfortunately, I can't point you to some hard evidence in the form of comprehensive documentation. From experience however I can tell you what this is used for: when you create components in Simple XML on a dashboard and you want to do something with it in javascript (e.g. add a custom table cell renderer to a table, change the options of a multiselect, listen to changes on inputs and much more). See here for a simple example, here for a more comprehensive one, and here for the (mostly) complete reference of this web framework.
There are two such methods: mvc.Components.get(), which will only work when the object is already there and throw an error if it isn't, and mvc.Components.getInstance() will create the object if it doesn't already exist - see this question here.

Generally, the frameworks used are listed here, so you will have to find most of the methods described within those (most importantly to you as a developer, backbone.js and jquery.js). However I have to admit that it can be frustrating sometimes, because for instance both backbone.js and jquery.js provide a method to listen to events with .on("change", someHandler), but their functions use slightly different syntax and you're left to figure out which one to use.

In the case of the get() you mentioned, I'd say it comes from backbone.js because it is in the class mvc which is also from backbone.

View solution in original post

0 Karma

jeffland
SplunkTrust
SplunkTrust

Unfortunately, I can't point you to some hard evidence in the form of comprehensive documentation. From experience however I can tell you what this is used for: when you create components in Simple XML on a dashboard and you want to do something with it in javascript (e.g. add a custom table cell renderer to a table, change the options of a multiselect, listen to changes on inputs and much more). See here for a simple example, here for a more comprehensive one, and here for the (mostly) complete reference of this web framework.
There are two such methods: mvc.Components.get(), which will only work when the object is already there and throw an error if it isn't, and mvc.Components.getInstance() will create the object if it doesn't already exist - see this question here.

Generally, the frameworks used are listed here, so you will have to find most of the methods described within those (most importantly to you as a developer, backbone.js and jquery.js). However I have to admit that it can be frustrating sometimes, because for instance both backbone.js and jquery.js provide a method to listen to events with .on("change", someHandler), but their functions use slightly different syntax and you're left to figure out which one to use.

In the case of the get() you mentioned, I'd say it comes from backbone.js because it is in the class mvc which is also from backbone.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

Splunk is officially part of Cisco

Revolutionizing how our customers build resilience across their entire digital footprint.   Splunk ...

Splunk APM & RUM | Planned Maintenance March 26 - March 28, 2024

There will be planned maintenance for Splunk APM and RUM between March 26, 2024 and March 28, 2024 as ...