Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bootstrap
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bootstrap
Commits
fae6c368
Commit
fae6c368
authored
Jul 22, 2012
by
Jacob Thornton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds minLength #3960
parent
8281a902
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
42 additions
and
7 deletions
+42
-7
docs/assets/js/bootstrap-typeahead.js
docs/assets/js/bootstrap-typeahead.js
+3
-2
docs/assets/js/bootstrap.js
docs/assets/js/bootstrap.js
+3
-2
docs/assets/js/bootstrap.min.js
docs/assets/js/bootstrap.min.js
+1
-1
docs/javascript.html
docs/javascript.html
+6
-0
docs/templates/pages/javascript.mustache
docs/templates/pages/javascript.mustache
+6
-0
js/bootstrap-typeahead.js
js/bootstrap-typeahead.js
+3
-2
js/tests/unit/bootstrap-typeahead.js
js/tests/unit/bootstrap-typeahead.js
+20
-0
No files found.
docs/assets/js/bootstrap-typeahead.js
View file @
fae6c368
...
...
@@ -81,7 +81,7 @@
this
.
query
=
this
.
$element
.
val
()
if
(
!
this
.
query
)
{
if
(
!
this
.
query
||
this
.
query
.
length
<
this
.
options
.
minLength
)
{
return
this
.
shown
?
this
.
hide
()
:
this
}
...
...
@@ -279,12 +279,13 @@
,
items
:
8
,
menu
:
'
<ul class="typeahead dropdown-menu"></ul>
'
,
item
:
'
<li><a href="#"></a></li>
'
,
minLength
:
1
}
$
.
fn
.
typeahead
.
Constructor
=
Typeahead
/* TYPEAHEAD DATA-API
/*
TYPEAHEAD DATA-API
* ================== */
$
(
function
()
{
...
...
docs/assets/js/bootstrap.js
View file @
fae6c368
...
...
@@ -1690,7 +1690,7 @@
this
.
query
=
this
.
$element
.
val
()
if
(
!
this
.
query
)
{
if
(
!
this
.
query
||
this
.
query
.
length
<
this
.
options
.
minLength
)
{
return
this
.
shown
?
this
.
hide
()
:
this
}
...
...
@@ -1888,12 +1888,13 @@
,
items
:
8
,
menu
:
'
<ul class="typeahead dropdown-menu"></ul>
'
,
item
:
'
<li><a href="#"></a></li>
'
,
minLength
:
1
}
$
.
fn
.
typeahead
.
Constructor
=
Typeahead
/* TYPEAHEAD DATA-API
/*
TYPEAHEAD DATA-API
* ================== */
$
(
function
()
{
...
...
docs/assets/js/bootstrap.min.js
View file @
fae6c368
This diff is collapsed.
Click to expand it.
docs/javascript.html
View file @
fae6c368
...
...
@@ -1543,6 +1543,12 @@ $('.carousel').carousel({
<td>
8
</td>
<td>
The max number of items to display in the dropdown.
</td>
</tr>
<tr>
<td>
minLength
</td>
<td>
number
</td>
<td>
1
</td>
<td>
The minimum character length needed before triggering autocomplete suggestions
</td>
</tr>
<tr>
<td>
matcher
</td>
<td>
function
</td>
...
...
docs/templates/pages/javascript.mustache
View file @
fae6c368
...
...
@@ -1474,6 +1474,12 @@ $('.carousel').carousel({
<td>
8
</td>
<td>
{{
_i
}}
The max number of items to display in the dropdown.
{{/
i
}}
</td>
</tr>
<tr>
<td>
{{
_i
}}
minLength
{{/
i
}}
</td>
<td>
{{
_i
}}
number
{{/
i
}}
</td>
<td>
{{
_i
}}
1
{{/
i
}}
</td>
<td>
{{
_i
}}
The minimum character length needed before triggering autocomplete suggestions
{{/
i
}}
</td>
</tr>
<tr>
<td>
{{
_i
}}
matcher
{{/
i
}}
</td>
<td>
{{
_i
}}
function
{{/
i
}}
</td>
...
...
js/bootstrap-typeahead.js
View file @
fae6c368
...
...
@@ -81,7 +81,7 @@
this
.
query
=
this
.
$element
.
val
()
if
(
!
this
.
query
)
{
if
(
!
this
.
query
||
this
.
query
.
length
<
this
.
options
.
minLength
)
{
return
this
.
shown
?
this
.
hide
()
:
this
}
...
...
@@ -279,12 +279,13 @@
,
items
:
8
,
menu
:
'
<ul class="typeahead dropdown-menu"></ul>
'
,
item
:
'
<li><a href="#"></a></li>
'
,
minLength
:
1
}
$
.
fn
.
typeahead
.
Constructor
=
Typeahead
/* TYPEAHEAD DATA-API
/*
TYPEAHEAD DATA-API
* ================== */
$
(
function
()
{
...
...
js/tests/unit/bootstrap-typeahead.js
View file @
fae6c368
...
...
@@ -181,4 +181,24 @@ $(function () {
typeahead
.
$menu
.
remove
()
})
test
(
"
should start querying when minLength is met
"
,
function
()
{
var
$input
=
$
(
'
<input />
'
).
typeahead
({
source
:
[
'
aaaa
'
,
'
aaab
'
,
'
aaac
'
],
minLength
:
3
})
,
typeahead
=
$input
.
data
(
'
typeahead
'
)
$input
.
val
(
'
aa
'
)
typeahead
.
lookup
()
equals
(
typeahead
.
$menu
.
find
(
'
li
'
).
length
,
0
,
'
has 0 items in menu
'
)
$input
.
val
(
'
aaa
'
)
typeahead
.
lookup
()
equals
(
typeahead
.
$menu
.
find
(
'
li
'
).
length
,
3
,
'
has 3 items in menu
'
)
typeahead
.
$menu
.
remove
()
})
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment