Syntax
| HtmMultiColDropDown(ControlName, SQL[, SelectedValue][, KeyFieldName][, WidthPx][, ShowSearchBox][, EmbedScripts][, ShowHeader][, ContainerClassName][, HeaderClassName][, RowClassName][, SelectionClassName][, Style])
| ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description
| The HtmMultiColDropDown function creates an advanced multi-column dropdown control by leveraging the Select2 library. This function builds a <select> element whose <option> elements carry data for multiple columns. The multi-column layout is achieved through custom JavaScript templates that render each option as a flexible, column-based display.
Key features include:
All columns from an SQL query are stored as data-colX attributes in each <option>.
An optional header row (if ShowHeader is set to true) displays the column names.
A custom matcher function is implemented to search across all columns.
Four different CSS class parameters allow you to control the styling:
Notes
The function stores all column values from the SQL query as data-colX attributes. The JavaScript templateResult and templateSelection functions use these attributes to render each option as a multi-column layout.
A custom matcher function is built into the Select2 configuration so that searching filters results based on all column data, not just the option text.
If EmbedScripts is set to True, the required jQuery and Select2 libraries are included in the output HTML via CDN. Ensure you have a proper internet connection, or include these libraries manually in your page header.
The provided class name parameters allow complete styling control. In your CSS file, you might define:
.container-class { /* styles for the entire Select2 container */ }
.blue-head { font-size:18pt; color:blue; font-weight:bold; }
.dark-text { color:#666666; }
.blue-text { font-size:14pt; color:blue; }
These classes will be applied to the corresponding parts of the dropdown.
| ||||||||||||||||||||||||||||
See Also
| |||||||||||||||||||||||||||||
Example
| Sub Main() |