I am using bootstrap multiselect list box. When user selects options on the multiselect it shows correctly. But there is a option to reset the previously selected options. When user click on reset button, automatically style=display:none
is adding to the dropdown button and the dropdown list is becomes invisible.
This is my code
$("#button").click(function () {
$('option', $('.multiselect')).each(function (element) {
$(this).removeAttr('selected').prop('selected', false);
});
$('.multiselect').multiselect('refresh');
});
Other helpful options are:
$('Id').multiselect('refresh');
- Refreshs the multiselect based on the selected options of the select.
$('Id').multiselect('destroy');
- Unbinds the whole plugin.
buildFilter
:Builds the filter.
buildSelectAll
: Build the selct all.Checks if a select all has already been created.
$('Id').multiselect('select', ['1', '2', '4']);
- Select all options of the given values.
clearSelection
: Clears all selected items.
$('Id').multiselect('deselect', ['1', '2', '4']);
- Deselects all options of the given values.
$('Id').multiselect('selectAll', true);
- Selects all enabled & visible options.
$('Id').multiselect('deselectAll', true);
- Deselects all options.
$('Id').multiselect('rebuild');
- Rebuild the plugin.
$('Id').multiselect('enable');
- Enable the multiselect.
$('Id').multiselect('disable');
- Disable the multiselect.
hasSelectAll
: Checks whether a select all checkbox is present.
updateSelectAll
: Updates the select all checkbox based on the currently displayed and selected checkboxes.
$('Id').multiselect('updateButtonText');
- Update the button text and its title based on the currently selected options.
getSelected()
: Get all selected options.
getOptionByValue()
: Gets a select option by its value.
$('Id').multiselect('dataprovider', options);
- The provided data will be used to build the dropdown.
for more detail visit bootstrap-multiselect