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!

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...