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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...