File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,12 @@ $(function() {
101
101
<td valign="top"><code>string</code></td>
102
102
<td valign="top"><code>null</code></td>
103
103
</tr>
104
+ <tr>
105
+ <td valign="top"><code>addPrecedence</code></td>
106
+ <td valign="top">Sets if the "Add..." option should be the default selection in the dropdown.</td>
107
+ <td valign="top"><code>boolean</code></td>
108
+ <td valign="top"><code>false</code></td>
109
+ </tr>
104
110
<tr>
105
111
<th valign="top" colspan="4" align="left"><a href="#data_searching" name="data_searching">Data / Searching</a></th>
106
112
</tr>
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ Selectize.defaults = {
10
10
maxOptions : 1000 ,
11
11
maxItems : null ,
12
12
hideSelected : null ,
13
+ addPrecedence : false ,
13
14
preload : false ,
14
15
15
16
scrollDuration : 60 ,
Original file line number Diff line number Diff line change @@ -974,10 +974,10 @@ $.extend(Selectize.prototype, {
974
974
self . hasOptions = results . items . length > 0 || hasCreateOption ;
975
975
if ( self . hasOptions ) {
976
976
if ( results . items . length > 0 ) {
977
- if ( $create ) {
977
+ if ( $create && ! self . settings . addPrecedence ) {
978
978
$active = self . getAdjacentOption ( $create , 1 ) ;
979
979
} else {
980
- $active = $dropdown_content . find ( " [data-selectable]" ) . first ( ) ;
980
+ $active = $dropdown_content . find ( ' [data-selectable]: first' ) ;
981
981
}
982
982
} else {
983
983
$active = $create ;
You can’t perform that action at this time.
0 commit comments