Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyrille37 committed May 7, 2020
1 parent 3ccface commit 95ec9b3
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 14 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ When calling `$("#element").bootstrapDualListbox()` you can pass a parameters ob
- `bootstrap2Compatible`, defaults to `false`, set this to `true` if you want graphic compatibility with Bootstrap 2.
- `bootstrap3Compatible`, defaults to `false`, set this to `true` if you want graphic compatibility with Bootstrap 3.
- `filterTextClear`, defaults to `'show all'`, is the text for the "Show All" button.
- `filterBtnClass`, defaults to `'btn btn-sm btn-outline-secondary'`, is the css class for the "Show All" button.
- `filterPlaceHolder`, defaults to `'Filter'`, is the placeholder for the `input` element for filtering elements.
- `btnClass`, default to `'btn-outline-secondary'`, is css class for move and remove button.
- `moveSelectedLabel`, defaults to `'Move selected'`, is the label for the "Move Selected" button.
- `moveAllLabel`, defaults to `'Move all'`, is the label for the "Move All" button.
- `removeSelectedLabel`, defaults to `'Remove selected'`, is the label for the "Remove Selected" button.
Expand All @@ -63,9 +65,9 @@ When calling `$("#element").bootstrapDualListbox()` you can pass a parameters ob
- `infoTextFiltered`, defaults to `'<span class="label label-warning">Filtered</span> {0} from {1}'`, determines which element format to use when some element is filtered. Remember to insert the `{0}` and `{1} `placeholders.
- `infoTextEmpty`, defaults to `'Empty list'`, determines the `string` to use when there are no options in the list.
- `filterOnValues`, defaults to `false`, set this to `true` to filter the `option`s according to their `value`s and not their HTML contents.
- `iconsPrefix`, defaults to `oi`, set it to whichever prefix your icon family uses.
- `iconMove`, defaults to `oi-arrow-thick-right`, sets the class for the move icon.
- `iconRemove`, defaults to `oi-arrow-thick-left`, sets the class for the remove icon.
- ~~`iconsPrefix`, defaults to `oi`, set it to whichever prefix your icon family uses.~~
- ~~`iconMove`, defaults to `oi-arrow-thick-right`, sets the class for the move icon.~~
- ~~`iconRemove`, defaults to `oi-arrow-thick-left`, sets the class for the remove icon.~~

### Methods

Expand Down
20 changes: 15 additions & 5 deletions dist/jquery.bootstrap-duallistbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
var pluginName = 'bootstrapDualListbox',
defaults = {
filterTextClear: 'show all',
filterBtnClass: 'btn btn-sm btn-outline-secondary',
filterPlaceHolder: 'Filter',
moveSelectedLabel: 'Move selected',
moveAllLabel: 'Move all',
Expand Down Expand Up @@ -109,7 +110,7 @@
}

function formatString(s, args) {
console.log(s, args);
//console.log(s, args);
return s.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] !== 'undefined' ? args[number] : match;
});
Expand Down Expand Up @@ -177,7 +178,12 @@
return;
}

saveSelections(dualListbox, selectIndex);
// Cyrille37 patch https://github.com/istvan-ujjmeszaros/bootstrap-duallistbox/pull/75
//saveSelections(dualListbox, selectIndex);
if( ! dualListbox.settings.moveOnSelect )
{
saveSelections(dualListbox, selectIndex);
}

dualListbox.elements['select'+selectIndex].empty().scrollTop(0);
var regex,
Expand All @@ -191,7 +197,11 @@
}

try {
regex = new RegExp($.trim(dualListbox.elements['filterInput'+selectIndex].val()), 'gi');
// Cyrille37 patch https://github.com/istvan-ujjmeszaros/bootstrap-duallistbox/issues/167
var filterInput = $
.trim(dualListbox.elements['filterInput'+selectIndex].val())
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
regex = new RegExp(filterInput, 'gi');
}
catch(e) {
// a regex to match nothing
Expand Down Expand Up @@ -406,7 +416,7 @@
' <label></label>' +
' <span class="info-container">' +
' <span class="info"></span>' +
' <button type="button" class="btn btn-sm clear1" style="float:right!important;"></button>' +
' <button type="button" class="clear1 '+this.settings.filterBtnClass+'" style="float:right!important;"></button>' +
' </span>' +
' <input class="form-control filter" type="text">' +
' <div class="btn-group buttons">' +
Expand All @@ -419,7 +429,7 @@
' <label></label>' +
' <span class="info-container">' +
' <span class="info"></span>' +
' <button type="button" class="btn btn-sm clear2" style="float:right!important;"></button>' +
' <button type="button" class="btn clear2 '+this.settings.filterBtnClass+'" style="float:right!important;"></button>' +
' </span>' +
' <input class="form-control filter" type="text">' +
' <div class="btn-group buttons">' +
Expand Down

0 comments on commit 95ec9b3

Please sign in to comment.