Splunk Search

How to set a multi drop-down value from JavaScript once a dynamic search has populated its options?

ollie920049
Path Finder

Hi,

I have a multi drop-down menu that is populated from a search. I want to set the value of the drop-down menu as 'X' when the search has populated 'X' as an option (the search should always return this value).

So far I can grab the element:

mvc.Components.getInstance('input2')

However, I can only see the statically assigned values of the object when I grab this via the developer console in the browser.

Does anybody know if I can register a handler against this object that listens for change, and if it changes enumerates the options and sets 'X' if found?

Hope this makes sense.

Thanks,
Ollie

0 Karma

csperry_splunk
Splunk Employee
Splunk Employee

I know this is old post, but I've run into this and had to work out an answer.

I ended up listening to the on change event for the searchmanager being used by the dropdown, then parse the array (of arrays) returned in its data().rows. I'm still trying to figure out the setting of selected value via JS, but one thing at a time right.

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...