Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bootstrap-multiselect
Project
Project
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-multiselect
Commits
55434cce
Commit
55434cce
authored
Apr 25, 2013
by
Luís Rudge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added the textbox behaviour
parent
639385f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
5 deletions
+43
-5
index.html
index.html
+20
-3
bootstrap-multiselect.js
js/bootstrap-multiselect.js
+23
-2
No files found.
index.html
View file @
55434cce
...
@@ -109,6 +109,8 @@
...
@@ -109,6 +109,8 @@
$
(
'
#example25
'
).
multiselect
({
dropRight
:
true
});
$
(
'
#example25
'
).
multiselect
({
dropRight
:
true
});
$
(
'
#example27
'
).
multiselect
({
includeSelectAllOption
:
true
});
$
(
'
#example27
'
).
multiselect
({
includeSelectAllOption
:
true
});
$
(
'
#example28
'
).
multiselect
({
includeSelectAllOption
:
true
,
enableFiltering
:
true
,
maxHeight
:
100
});
});
});
</script>
</script>
<p>
<p>
...
@@ -145,9 +147,24 @@
...
@@ -145,9 +147,24 @@
Select with preselected options:
<code>
<
option value=
"
cheese
"
selected
>
Cheese
<
/option
>
</code>
Select with preselected options:
<code>
<
option value=
"
cheese
"
selected
>
Cheese
<
/option
>
</code>
</td>
</td>
</tr>
</tr>
<tr>
<tr>
<td>
<select
id=
"example27"
multiple=
"multiple"
>
<option
value=
"cheese"
>
Cheese
</option>
<option
value=
"tomatoes"
>
Tomatoes
</option>
<option
value=
"mozarella"
>
Mozzarella
</option>
<option
value=
"mushrooms"
>
Mushrooms
</option>
<option
value=
"pepperoni"
>
Pepperoni
</option>
<option
value=
"onions"
>
Onions
</option>
</select>
</td>
<td>
Multiselect with a 'Select all' option
</td>
</tr>
<tr>
<td>
<td>
<select
id=
"example2
7
"
multiple=
"multiple"
>
<select
id=
"example2
8
"
multiple=
"multiple"
>
<option
value=
"cheese"
>
Cheese
</option>
<option
value=
"cheese"
>
Cheese
</option>
<option
value=
"tomatoes"
>
Tomatoes
</option>
<option
value=
"tomatoes"
>
Tomatoes
</option>
<option
value=
"mozarella"
>
Mozzarella
</option>
<option
value=
"mozarella"
>
Mozzarella
</option>
...
@@ -157,7 +174,7 @@
...
@@ -157,7 +174,7 @@
</select>
</select>
</td>
</td>
<td>
<td>
Multiselect with a 'Select all' option
Multiselect with a 'Select all' option
and filtering enabled
</td>
</td>
</tr>
</tr>
<tr>
<tr>
...
...
js/bootstrap-multiselect.js
View file @
55434cce
...
@@ -47,12 +47,28 @@
...
@@ -47,12 +47,28 @@
this
.
options
=
this
.
getOptions
(
options
);
this
.
options
=
this
.
getOptions
(
options
);
this
.
$select
=
$
(
select
);
this
.
$select
=
$
(
select
);
this
.
query
=
''
;
this
.
options
.
multiple
=
this
.
$select
.
attr
(
'
multiple
'
)
==
"
multiple
"
;
this
.
options
.
multiple
=
this
.
$select
.
attr
(
'
multiple
'
)
==
"
multiple
"
;
this
.
$container
=
$
(
this
.
options
.
buttonContainer
)
this
.
$container
=
$
(
this
.
options
.
buttonContainer
)
.
append
(
'
<button type="button" class="multiselect dropdown-toggle
'
+
this
.
options
.
buttonClass
+
'
" data-toggle="dropdown">
'
+
this
.
options
.
buttonText
(
this
.
getSelected
(),
this
.
$select
)
+
'
</button>
'
)
.
append
(
'
<button type="button" class="multiselect dropdown-toggle
'
+
this
.
options
.
buttonClass
+
'
" data-toggle="dropdown">
'
+
this
.
options
.
buttonText
(
this
.
getSelected
(),
this
.
$select
)
+
'
</button>
'
)
.
append
(
'
<ul class="dropdown-menu
'
+
(
this
.
options
.
dropRight
?
'
pull-right
'
:
''
)
+
'
"></ul>
'
);
.
append
(
'
<ul class="dropdown-menu
'
+
(
this
.
options
.
dropRight
?
'
pull-right
'
:
''
)
+
'
"></ul>
'
);
if
(
this
.
options
.
enableFiltering
)
{
$
(
'
ul
'
,
this
.
$container
).
prepend
(
'
<div class="input-prepend" style="padding:3px;"><span class="add-on"><i class="icon-search"></i></span><input id="multiselect-default-search" type="text" placeholder="
'
+
this
.
options
.
filterPlaceholder
+
'
"></div>
'
);
$
(
'
#multiselect-default-search
'
,
this
.
$container
).
val
(
this
.
query
).
click
(
function
(
event
)
{
event
.
stopPropagation
();
}).
keydown
(
$
.
proxy
(
function
(
event
)
{
// This is useful to catch "keydown" events after the browser has updated the control
setTimeout
(
$
.
proxy
(
function
()
{
var
inputValue
=
event
.
target
.
value
;
if
(
inputValue
!=
this
.
query
)
{
this
.
query
=
inputValue
;
}
},
this
),
0
);
},
this
));
}
if
(
this
.
options
.
buttonWidth
)
{
if
(
this
.
options
.
buttonWidth
)
{
$
(
'
button
'
,
this
.
$container
).
css
({
$
(
'
button
'
,
this
.
$container
).
css
({
...
@@ -67,6 +83,8 @@
...
@@ -67,6 +83,8 @@
'
overflow-y
'
:
'
auto
'
,
'
overflow-y
'
:
'
auto
'
,
'
overflow-x
'
:
'
hidden
'
'
overflow-x
'
:
'
hidden
'
});
});
$
(
'
input[type="text"]
'
,
this
.
$container
).
width
(
'
75%
'
);
}
}
this
.
buildDropdown
();
this
.
buildDropdown
();
...
@@ -114,7 +132,9 @@
...
@@ -114,7 +132,9 @@
// If maximum height is exceeded a scrollbar will be displayed.
// If maximum height is exceeded a scrollbar will be displayed.
maxHeight
:
false
,
maxHeight
:
false
,
includeSelectAllOption
:
false
,
includeSelectAllOption
:
false
,
selectAllText
:
'
Select all
'
selectAllText
:
'
Select all
'
,
enableFiltering
:
false
,
filterPlaceholder
:
'
Search
'
},
},
constructor
:
Multiselect
,
constructor
:
Multiselect
,
...
@@ -248,7 +268,8 @@
...
@@ -248,7 +268,8 @@
});
});
// Keyboard support.
// Keyboard support.
this
.
$container
.
on
(
'
keydown
'
,
$
.
proxy
(
function
(
event
)
{
this
.
$container
.
on
(
'
keydown
'
,
$
.
proxy
(
function
(
event
)
{
if
(
$
(
'
input[type="text"]
'
,
this
.
$container
).
is
(
'
:focus
'
))
return
;
if
((
event
.
keyCode
==
9
||
event
.
keyCode
==
27
)
&&
this
.
$container
.
hasClass
(
'
open
'
))
{
if
((
event
.
keyCode
==
9
||
event
.
keyCode
==
27
)
&&
this
.
$container
.
hasClass
(
'
open
'
))
{
// Close on tab or escape.
// Close on tab or escape.
$
(
this
.
$container
).
find
(
"
.multiselect.dropdown-toggle
"
).
click
();
$
(
this
.
$container
).
find
(
"
.multiselect.dropdown-toggle
"
).
click
();
...
...
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