All Apps and Add-ons

How to change the selected value in Pulldown menu?

cycheng
Path Finder

I'm using LinkSwitcher to create Page1 and Page2. Inside these two pages, there is a pulldown menu called version and it contains value{"1.0","2.0","3.0","4.0"}. I would like to set the default version to 2.0. So I use ValueSetter module to do so. But I found that only Page1 will adopt the preset value, while the Page2 still showing 4.0.

1) How can I set the Page2 to use the default value set in ValueSetter?
2) How can I make these pulldown controls to always use the updated value in URL? If I choose 3.0 in Page1, the URL shows the #version=3.0&autoRun=True, but if I clicked Page2, it is still showing 4.0.

<view isSticky="False" isVisible="true" onunloadCancelJobs="true" template="dashboard.html">
  <label>ABC</label>
  <module name="AccountBar" layoutPanel="appHeader" />
  <module name="AppBar" layoutPanel="appHeader" />

  <module name="SideviewUtils" layoutPanel="appHeader">
  <param name="customJavascript">sideview_utils/report.js sideview_utils/save_create_patches.js</param>
  <param name="customStylesheet">sideview_utils/report.css</param>
  </module>

  <module name="Message" layoutPanel="messaging">
    <param name="filter">*</param>
    <param name="maxSize">2</param>
    <param name="clearOnJobDispatch">False</param>
  </module>

  <module name="URLLoader" layoutPanel="viewHeader" autoRun="True">
    <param name="keepURLUpdated">True</param>

    <module name="ValueSetter" layoutPanel="viewHeader">
      <param name="name">version</param>
      <param name="value">2.0</param>
      <param name="allowClobber">False</param>

      <module name="LinkSwitcher" layoutPanel="panel_row1_col1" group="ABC">
        <param name="mode">independent</param>
        <param name="label"> </param>
        <param name="disableOnNull">True</param>

        <module name="Search" group="Page1">
          <param name="search"><mysearch></param>

          <module name="Pulldown">
            <param name="valueField">$name$</param>
            <param name="label">Version</param>
            <param name="name">version</param>
            <param name="template">"$value$"</param>
            <param name="staticOptions"></param>
          </module>
        </module>

        <module name="Search" group="Page2">
          <param name="search"><mysearch></param>

          <module name="Pulldown">
            <param name="valueField">$name$</param>
            <param name="label">Version</param>
            <param name="name">version</param>
            <param name="template">"$value$"</param>
            <param name="staticOptions"></param>
          </module>
        </module>
      </module>
    </module>
  </module>
</view>

sideview
SplunkTrust
SplunkTrust

I think what's happening is that the keepUrlUpdated=True on your URLLoader is kind of taking charge, and the allowClobber=False on the ValueSetter is making ValueSetter back off and defer to the URLLoader value. You seem to know what you're doing so hopefully this explanation makes sense.

I'm not positive that this is the cause, but it seems a good candidate. I think the workaround may be to not use the same $foo$ token for both branches, and thus you'd have to set two different ValueSetters... .

0 Karma

sowings
Splunk Employee
Splunk Employee

The standard Splunk modules would use the "selected" param to something like SearchSelectLister. The format looks like:


<param name="selected">VALUE YOU WANT SELECTED</param>

I don't see such a param listed expressly in the docs for the Pulldown module, but I have an admittedly old version of sideview. You might consider trying it.

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) v3.54.0

The Splunk Threat Research Team (STRT) recently released Enterprise Security Content Update (ESCU) v3.54.0 and ...

Using Machine Learning for Hunting Security Threats

WATCH NOW Seeing the exponential hike in global cyber threat spectrum, organizations are now striving more for ...

New Learning Videos on Topics Most Requested by You! Plus This Month’s New Splunk ...

Splunk Lantern is a customer success center that provides advice from Splunk experts on valuable data ...