<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<div>
<h2>Creating a custom drop-down menu inside the Toolbar</h2>
<p>
This example shows how to extend the Toolbar with a custom drop-down menu
that lets users quickly switch between predefined reports.
</p>
<p>
<b>Step 1.</b> We use the <code>customizeToolbar()</code> function (lines
67-127 in the JavaScript box) as the
<a
href="https://www.flexmonster.com/api/beforetoolbarcreated/"
target="_blank"
>beforetoolbarcreated</a> event's handler to add a drop-down menu that
switches reports to the Toolbar.
</p>
<p>
<b>Step 2.</b> When a report is selected from the menu,
<code>changeReport()</code> (lines 129-309) switches the slice and displays
options based on the chosen value using
<a href="https://www.flexmonster.com/api/runquery/" target="_blank"
>runQuery()</a> and
<a href="https://www.flexmonster.com/api/setoptions/" target="_blank"
>setOptions()</a> methods.
</p>
<p>
See another
<a href="https://jsfiddle.net/flexmonster/gen79fd8/" target="_blank"
>example of a custom report picker</a>.
</p>
<p>
Learn more about
<a
href="https://www.flexmonster.com/doc/creating-a-custom-ui-control-or-view"
target="_blank"
>creating a custom UI control or view</a>.
</p>
</div>
<div id="pivot-container"></div>