Chosen-Dojo
Chosen-Dojo is a Dojo port of Chosen. Chosen is a JavaScript plugin
that makes long, unwieldy select boxes much more user-friendly.
Standard Select
Turns This
Into This
Multiple Select
Turns This
Into This
Update List
<optgroup> Support
Single Select with Groups
Multiple Select with Groups
<optgroup> Support with batch select
Setting batch_select: true
option allows batch selection when clicking on the optgroup value.
Multiple Select with Groups
Selected and Disabled Support
Chosen automatically highlights selected options and removes disabled options.
Single Select
Multiple Select
Allow Deselect on Single Selects
When a single select box isn't a required field, you can set allow_single_deselect: true
and Chosen
will add a UI element for option deselection. This will only work if the first option has blank text.
Update Events
If you need to update the options in your select field and want Chosen to pick up the changes, you'll need to
trigger the "liszt:updated" event on the field. Chosen will re-build itself based on the updated content.
Update List
var select_object = dom.byId('select4'); topic.publish('liszt:updated', [select_object]);
Right to Left Support
Chosen supports right to left select boxes too. just add "chzn-rtl"
in addition to "chzn-select"
to your select tags and you are good to go.
<select class="chzn-select chzn-rtl">
Single right to left select
Multiple right to left select