Use the Long List - Single Selection control when you need to select an item from a large number of options. There are two states for this control
Use the class .truncate
to init the jquery.truncator plugin.
- Long List Option 2
...
- Long List Option 7
Add the disabled
attribute to the select
to create a read-only mode component.
Parameter | Values | Default | Functionality |
---|---|---|---|
container | String | N/A | jQuery selector where component will be rendered |
id | String | N/A | Class ID of element. This is required. |
dataset | Array of Objects | [{id: 1, text: 'Option 1'}, ...] these items will be displayed in selector | |
val | Array of keys | [] | Initial selection. If not `multiple` then will use first element. Provide a list of ids, no need to provide whole objects as provided to `dataSet` |
styleWidth | String | 100% | inline style for select |
enabled | Boolean | true | Enable/disable the input |
allowClear | Boolean | true | Allow clear for single select |
multiple | Boolean | false | Enable/Disable multiple selection |
placeholder | String | Make a selection | Placeholder text |
onSelection | function | Callback for selection event | |
ajax | object | Ajax support, see documentation of Select2 3.5.2 | |
ajaxDefault | Array of Objects | Initial selection. If not `multiple` then will use first element. Provide a list of object (representing what ajax would return) | |
initSelection | Array | default implementation returns ajaxDefault objects | initSelection support, see documentation of Select2 3.5.2 |