Dashboards & Visualizations

Dropdown width change not working properly

wangkevin1029
Communicator

Hi, Splunkers, 

 I used the following code to change my dropdown input width, 

 

       .input-dropdown {
          min-width: 120px !important;
          width: 120px !important;
          max-width: 120px !important;
        }
        .splunk-dropdown .select2-container {
          min-width: 120px !important;
          width: 120px !important;
          max-width: 120px !important;
        }

when I changed width, the width of the dropdown area decreased,  but the dropdown field width not change, which caused the dropdown overlapped with the next dropdown.

I tried some different combination of these widths,  also the following HTML  text/css,   also margin-bottom,  etc, etc,  but whatever I tried,  only the width of  whole area dropdown changed,  never worked for   the dropdown box width. 

wangkevin1029_0-1645238567080.png

I also tried the following CSS  code,  but have the same issue.

    <html>
      <style type="text/css">
#input_unit {
  width: 440px;
}
      </style>
    </html>

thx in advance.

 

Kevin

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Sorry, my mistake. There was an extra semi-colon which should be removed.

    <html>
      <style type="text/css">
          #TargetSEValidationID div[data-component="splunk-core:/splunkjs/mvc/components/Dropdown"]
          {
            max-width: 140px !important;
            width: 120px !important;
          }
      </style>
    </html>

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

    <html>
      <style type="text/css">
          #input_unit div[data-component="splunk-core:/splunkjs/mvc/components/Dropdown"]
          {
            width: 440px; !important;
          }
      </style>
    </html>
0 Karma

wangkevin1029
Communicator

ITWhisperer, 

thx for your quick response.

 

I put your code in front of my dropdown id  TargetSEValidationid.

unfortunately, width change not working here, I attached a screenshot below.

besides,  this code looks inserts a line break before it. whatever width I put here, there is always just a line break.

I am pretty sure, this code causes this line break.

 <html>

      <style type="text/css">

          #TargetSEValidationid div[data-component="splunk-core:/splunkjs/mvc/components/Dropdown"]

          {

            width: 100px; !important;

          }

      </style>

    </html>

 

    <input id="TargetSEValidationid" type="dropdown" token="t_TargetSEValidation" searchWhenChanged="true">

      <label>TargetSEValidation</label>

      <choice value=".">ALL</choice>

      <choice value="TRUE">TRUE</choice>

      <choice value="FALSE">FALSE</choice>

      <default>.</default>

      <initialValue>.</initialValue>

    </input>

 

wangkevin1029_0-1645285878870.png

Kevin

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Two things: you could try adding max-width: as well as width, and also the changes don't show up in edit mode, you have to save the changes

0 Karma

wangkevin1029
Communicator

 

Hi, ITWhisperer, 

 

Now I added  max-width,  it looks better, but not fully working, now,  field box width changed, but area width not changed. 

 

before I added max-width, area width decreased, but field box not changed.

          #TargetSEValidationID div[data-component="splunk-core:/splunkjs/mvc/components/Dropdown"]

          {

            width: 120px; !important;

            max-width: 140px; !important;

          }

wangkevin1029_2-1645310119259.png

 

wangkevin1029_0-1645310089403.png

 

 

Kevin

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Sorry, my mistake. There was an extra semi-colon which should be removed.

    <html>
      <style type="text/css">
          #TargetSEValidationID div[data-component="splunk-core:/splunkjs/mvc/components/Dropdown"]
          {
            max-width: 140px !important;
            width: 120px !important;
          }
      </style>
    </html>

wangkevin1029
Communicator

I  added another  css here, it works now, not sure why,  but it works beautifully as I expected.

thank you very much.

wangkevin1029_0-1645324925529.png

 

          #TargetSEValidationID {

            width: 140px;

}

 

      #TargetSEValidationID div[data-component="splunk-core:/splunkjs/mvc/components/Dropdown"]

          {

            width: 120px; !important;

            max-width: 140px; !important;

          }

 

          #TargetSEValidationID {

            width: 140px;

}

0 Karma

wangkevin1029
Communicator

just tried, after removing semi-colon, box width  showing some difference,  but area width still no change.

basically, I have many input fields here, want to shrink them to save some space.

if only box width is decreased,  it won't save any space. 

Kevin

0 Karma
Get Updates on the Splunk Community!

New This Month in Splunk Observability Cloud - Metrics Usage Analytics, Enhanced K8s ...

The latest enhancements across the Splunk Observability portfolio deliver greater flexibility, better data and ...

Alerting Best Practices: How to Create Good Detectors

At their best, detectors and the alerts they trigger notify teams when applications aren’t performing as ...

Discover Powerful New Features in Splunk Cloud Platform: Enhanced Analytics, ...

Hey Splunky people! We are excited to share the latest updates in Splunk Cloud Platform 9.3.2408. In this ...