Let's assume 1st drop down values are 1.workplace , 2. Sales , 3. Marketing and 4 . Production.
2nd drop down values depend upon the locations.
Case -1 :If I select
India - show only Sales & Marketing
USA - show only Production
Argentina - show only workplace
Case 2: Same way I have 4 panel with some query.
If I select workplace, it should show Workplace panel with hiding all other panel.
Case3: Location as India and 2nd drop down as a sales . It should only Sales panel.
How can I get this, please help me out.
Thanks in Advance.
Hello All,
I need your help to hide and display a panel on the dashboard based on end user's selection of using a dropdown or radio button.
Please help by sharing your approach.
Thank you
Have each panel that you want to hide or show have a depends attribute specifying a unique token.
In the change handler for your selection dropdown, set the corresponding token based on whether the value has been selected.
Depending on how you want the hiding to work, you could either unset all the other tokens, or have a dropdown value "Hide all" for example, which you unset all the panel tokens
Thank you for your response. I was able to build the functionality successfully. I have added the code for reference: -
<row>
<panel>
<input type="checkbox" token="xxxToken">
<label>Show xxx details</label>
<choice value="1">Show</choice>
<initialValue>1</initialValue>
</input>
</panel>
</row>
<row>
<panel depends="$xxxToken$">
<table>
...
</table>
</panel>
</row>
Please share if you have any suggestions to improve the same.
Thank you
There are many ways to accomplish this, and the best will depend on what effect your are trying to achieve.
The general answer is - put either a "depends" or a "rejects" on each panel, and set or unset the desired tokens based on the selection in each dropdown.
This is a run-anywhere screen that will show you how to do this process.
<form>
<label>Admin dropdown test</label>
<search id="basechoices">
<query>
| makeresults
| eval mydata="India|Sales!!!!India|Marketing!!!!Argentina|Workplace!!!!USA|Production"
| table mydata
| makemv delim="!!!!" mydata
| mvexpand mydata
| makemv delim="|" mydata
| eval location=mvindex(mydata,0)
| eval TheChoice=mvindex(mydata,1)
| table location TheChoice
</query>
<earliest>-5m</earliest>
<latest>now</latest>
</search>
<fieldset submitButton="false">
<input type="dropdown" token="tok_location">
<label>location</label>
<choice value="Argentina">Argentina</choice>
<choice value="India">India</choice>
<choice value="USA">USA</choice>
<change>
<unset token="form.tok_department"></unset>
<unset token="showSales"></unset>
<unset token="showMarketing"></unset>
<unset token="showProduction"></unset>
<unset token="showWorkplace"></unset>
</change>
<selectFirstChoice>false</selectFirstChoice>
</input>
<input type="dropdown" token="tok_department">
<label>department</label>
<search base="basechoices">
<query>
| where location= "$tok_location$"
| fields - location </query>
</search>
<fieldForLabel>TheChoice</fieldForLabel>
<fieldForValue>TheChoice</fieldForValue>
<selectFirstChoice>true</selectFirstChoice>
<change>
<condition match="$value$= "Sales" ">
<set token="showSales"></set>
<unset token="showMarketing"></unset>
<unset token="showProduction"></unset>
<unset token="showWorkplace"></unset>
</condition>
<condition match="$value$= "Marketing" ">
<unset token="showSales"></unset>
<set token="showMarketing"></set>
<unset token="showProduction"></unset>
<unset token="showWorkplace"></unset>
</condition>
<condition match="$value$= "Production" ">
<unset token="showSales"></unset>
<unset token="showMarketing"></unset>
<set token="showProduction"></set>
<unset token="showWorkplace"></unset>
</condition>
<condition match="$value$= "Workplace" ">
<unset token="showSales"></unset>
<unset token="showMarketing"></unset>
<unset token="showProduction"></unset>
<set token="showWorkplace"></set>
</condition>
</change>
</input>
</fieldset>
<row>
<panel depends="$showProduction$">
<html>
<p> PRODUCTION PANEL</p>
</html>
</panel>
<panel depends="$showMarketing$">
<html>
<p> MARKETING PANEL</p>
</html>
</panel>
<panel depends="$showWorkplace$">
<html>
<p> WORKPLACE PANEL</p>
</html>
</panel>
<panel depends="$showSales$">
<html>
<p> SALES PANEL</p>
</html>
</panel>
</row>
</form>