Skip to content

Commit 6878b1d

Browse files
anandphulwanirisadams
authored andcommitted
Changed dropdownOnBackspaceGotoTop to deselectBehavior
1 parent 6cae801 commit 6878b1d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

docs/usage.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@ $(function() {
166166
<td valign="top"><code>60</code></td>
167167
</tr>
168168
<tr>
169-
<td valign="top"><code>dropdownOnBackspaceGotoTop</code></td>
170-
<td valign="top">If an option is selected, the same option is highlighted/marked active in the dropdown, pressing backspace on the input control removes the option and in dropdown the previous element is highlight. When this option is set to `true` it shifts the highlight to the topmost option.</td>
171-
<td valign="top"><code>boolean</code></td>
172-
<td valign="top"><code>false</code></td>
169+
<td valign="top"><code>deselectBehavior</code></td>
170+
<td valign="top">If an option is selected, the same option is highlighted/marked active in the dropdown, pressing backspace on the input control removes the option and in dropdown the previous element is highlight. When this option is set to `top` it shifts the highlight to the topmost option. Valid options are `top` and `previous`.</td>
171+
<td valign="top"><code>string</code></td>
172+
<td valign="top"><code>previous</code></td>
173173
</tr>
174174
<tr>
175175
<td valign="top"><code>loadThrottle</code></td>

src/defaults.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Selectize.defaults = {
2626
closeAfterSelect: false,
2727

2828
scrollDuration: 60,
29-
dropdownOnBackspaceGotoTop: false,
29+
deselectBehavior: 'previous', //top, previous
3030
loadThrottle: 300,
3131
loadingClass: 'loading',
3232

src/selectize.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1977,7 +1977,7 @@ $.extend(Selectize.prototype, {
19771977
selection = getSelection(self.$control_input[0]);
19781978

19791979
if (self.$activeOption && !self.settings.hideSelected) {
1980-
if (typeof self.settings.dropdownOnBackspaceGotoTop === 'boolean' && self.settings.dropdownOnBackspaceGotoTop) {
1980+
if (typeof self.settings.deselectBehavior === 'string' && self.settings.deselectBehavior === 'top') {
19811981
option_select = self.getFirstOption().attr('data-value');
19821982
} else {
19831983
option_select = self.getAdjacentOption(self.$activeOption, -1).attr('data-value');

0 commit comments

Comments
 (0)