<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<div>
<h2>
Creating a custom Field List with prefiltering and a custom filter view
</h2>
<p>
This example shows how to create a custom Field List where users can
prefilter fields. Also, the sample demonstrates a custom filter view.
</p>
<p>
<b>Step 1.</b> The
<a href="https://www.flexmonster.com/api/fieldslistopen/" target="_blank"
>fieldslistopen</a> and
<a href="https://www.flexmonster.com/api/filteropen/" target="_blank"
>filteropen</a> events are handled (lines 32-44 in the JavaScript box)
to override the default Field List and filter view. Instead, the event
handlers call the <code>openFieldList()</code> and <code>openFilter()</code>
functions to open the custom views.
</p>
<p>
<b>Step 2.</b> The <code>openFieldList()</code> function (lines 108-136)
calls Flexmonster methods to build the list of available fields. It also
uses two helper functions: <code>getFieldLocation()</code> (lines 248-265)
determines the current placement of each field in the slice, and
<code>createFieldItem()</code> (lines 149-210) renders the field. <br />To
apply the new slice and filters to the pivot table, the
<code>applySelectedFields()</code> function (lines 46-90) is called.
</p>
<p>
<b>Step 3.</b> The <code>openFilter()</code> function (lines 138-147)
creates the custom selection filter view. It calls
<a href="https://www.flexmonster.com/api/getmembers/" target="_blank"
>getMembers()</a> to fetch members of the selected field, and then
<code>createFilterItem()</code> (lines 212-233) to render each member. On
apply, the <code>applyFilter()</code> function (lines 92-106) keeps only
selected members in the slice.
</p>
<p>
Learn more about
<a
href="https://www.flexmonster.com/doc/creating-a-custom-ui-control-or-view"
...