|
1407 | 1407 | if (settings.allowAdditions) {
|
1408 | 1408 | module.remove.userAddition();
|
1409 | 1409 | }
|
1410 |
| - module.remove.filteredItem(); |
| 1410 | + if (!settings.keepSearchTerm) { |
| 1411 | + module.remove.filteredItem(); |
| 1412 | + module.remove.searchTerm(); |
| 1413 | + } |
1411 | 1414 | if (!module.is.visible() && $target.length > 0) {
|
1412 | 1415 | module.show();
|
1413 | 1416 | }
|
1414 |
| - module.remove.searchTerm(); |
1415 | 1417 | if (!module.is.focusedOnSearch() && skipRefocus !== true) {
|
1416 | 1418 | module.focusSearch(true);
|
1417 | 1419 | }
|
|
1597 | 1599 | module.verbose('Selecting item from keyboard shortcut', $selectedItem);
|
1598 | 1600 | module.event.item.click.call($selectedItem, event);
|
1599 | 1601 | if (module.is.searchSelection()) {
|
1600 |
| - module.remove.searchTerm(); |
| 1602 | + if (!settings.keepSearchTerm) { |
| 1603 | + module.remove.searchTerm(); |
| 1604 | + } |
1601 | 1605 | if (module.is.multiple()) {
|
1602 | 1606 | $search.trigger('focus');
|
1603 | 1607 | }
|
|
1814 | 1818 | ? value
|
1815 | 1819 | : text;
|
1816 | 1820 | if (module.can.activate($(element))) {
|
1817 |
| - module.set.selected(value, $(element)); |
| 1821 | + module.set.selected(value, $(element), false, settings.keepSearchTerm); |
1818 | 1822 | if (!module.is.multiple() && !(!settings.collapseOnActionable && $(element).hasClass(className.actionable))) {
|
1819 | 1823 | module.hideAndClear();
|
1820 | 1824 | }
|
|
2464 | 2468 | valueIsSet = searchValue !== ''
|
2465 | 2469 | ;
|
2466 | 2470 | if (isMultiple && hasSearchValue) {
|
2467 |
| - module.verbose('Adjusting input width', searchWidth, settings.glyphWidth); |
| 2471 | + module.verbose('Adjusting input width', searchWidth); |
2468 | 2472 | $search.css('width', searchWidth + 'px');
|
2469 | 2473 | }
|
2470 | 2474 | if (hasSearchValue || (isSearchMultiple && valueIsSet)) {
|
|
2763 | 2767 | return false;
|
2764 | 2768 | }
|
2765 | 2769 | module.debug('Setting selected menu item to', $selectedItem);
|
2766 |
| - if (module.is.multiple()) { |
| 2770 | + if (module.is.multiple() && !keepSearchTerm) { |
2767 | 2771 | module.remove.searchWidth();
|
2768 | 2772 | }
|
2769 | 2773 | if (module.is.single()) {
|
|
4006 | 4010 | forceSelection: false, // force a choice on blur with search selection
|
4007 | 4011 |
|
4008 | 4012 | allowAdditions: false, // whether multiple select should allow user added values
|
| 4013 | + keepSearchTerm: false, // whether the search value should be kept and menu stays filtered on item selection |
4009 | 4014 | ignoreCase: false, // whether to consider case sensitivity when creating labels
|
4010 | 4015 | ignoreSearchCase: true, // whether to consider case sensitivity when filtering items
|
4011 | 4016 | hideAdditions: true, // whether or not to hide special message prompting a user they can enter a value
|
|
4025 | 4030 | duration: 200, // duration of transition
|
4026 | 4031 | displayType: false, // displayType of transition
|
4027 | 4032 |
|
4028 |
| - glyphWidth: 1.037, // widest glyph width in em (W is 1.037 em) used to calculate multiselect input width |
4029 |
| - |
4030 | 4033 | headerDivider: true, // whether option headers should have an additional divider line underneath when converted from <select> <optgroup>
|
4031 | 4034 |
|
4032 | 4035 | collapseOnActionable: true, // whether the dropdown should collapse upon selection of an actionable item
|
|
0 commit comments