Skip to content

Commit

Permalink
preserve selected options for server generated html (#76)
Browse files Browse the repository at this point in the history
* preserve selected options for server generated html

* fix preserve selected options for server generated html
  • Loading branch information
debueb authored and truckingsim committed Jun 9, 2016
1 parent 77a05b8 commit 0d079a0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/js/classes/AjaxBootstrapSelectList.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,15 @@ var AjaxBootstrapSelectList = function (plugin) {
text: $option.text(),
'class': $option.attr('class') || '',
data: $option.data() || {},
preserved: false,
selected: false
preserved: plugin.options.preserveSelected,
selected: !!$option.attr('selected')
});
});
this.cacheSet(/*query=*/'', initial_options);

// Preserve selected options.
if (plugin.options.preserveSelected) {
that.selected = initial_options;
plugin.$element.on('change.abs.preserveSelected', function (e) {
var $selected = plugin.$element.find(':selected');
that.selected = [];
Expand Down

0 comments on commit 0d079a0

Please sign in to comment.