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
19f72356
Commit
19f72356
authored
Nov 08, 2013
by
David Stutz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/davidstutz/bootstrap-multiselect
parents
ae1cf5c3
3a0948ac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
4 deletions
+76
-4
index.html
index.html
+55
-0
bootstrap-multiselect.js
js/bootstrap-multiselect.js
+21
-4
No files found.
index.html
View file @
19f72356
...
...
@@ -610,6 +610,23 @@
buttonContainer:
'<
span class="dropdown" /
>'
});
});
<
/script
>
</pre>
</td>
</tr>
<tr>
<td><code>
label
</code></td>
<td>
Function to write the label of the item.
</td>
<td>
<pre
class=
"prettyprint linenums"
>
<
script type=
"
text/javascript
">
$(document).ready(function() {
$(
'
.multiselect
'
).multiselect({
label: function(element) {
return $(element).html()+
'
(
'
+$(element).val()+
'
)
'
;
}
});
});
<
/script
>
</pre>
</td>
...
...
@@ -648,6 +665,44 @@
</pre>
</td>
</tr>
<tr>
<td><code>
onDropdownShow
</code></td>
<td>
This event handler is triggered when the dropdown are shown.
</td>
<td>
<pre
class=
"prettyprint linenums"
>
<
script type=
"
text/javascript
">
$(document).ready(function() {
$(
'
.multiselect
'
).multiselect({
onDropdownShow: function(event) {
alert(
'
Show event invoked!
'
);
}
});
});
<
/script
>
</pre>
</td>
</tr>
<tr>
<td><code>
onDropdownHide
</code></td>
<td>
This event handler is triggered when the dropdown are hidden.
</td>
<td>
<pre
class=
"prettyprint linenums"
>
<
script type=
"
text/javascript
">
$(document).ready(function() {
$(
'
.multiselect
'
).multiselect({
onDropdownHide: function(event) {
alert(
'
Hide event invoked!
'
);
}
});
});
<
/script
>
</pre>
</td>
</tr>
<tr>
<td><code>
maxHeight
</code></td>
<td>
...
...
js/bootstrap-multiselect.js
View file @
19f72356
...
...
@@ -39,6 +39,8 @@
this
.
options
.
multiple
=
this
.
$select
.
attr
(
'
multiple
'
)
==
"
multiple
"
;
this
.
options
.
onChange
=
$
.
proxy
(
this
.
options
.
onChange
,
this
);
this
.
options
.
onDropdownShow
=
$
.
proxy
(
this
.
options
.
onDropdownShow
,
this
);
this
.
options
.
onDropdownHide
=
$
.
proxy
(
this
.
options
.
onDropdownHide
,
this
);
// Build select all if enabled.
this
.
buildContainer
();
...
...
@@ -57,14 +59,14 @@
// Default options.
defaults
:
{
// Default text function will either print 'None selected' in case no
// option is selected, or a list of the selected options up to a length of 3 selected options.
// option is selected, or a list of the selected options up to a length of 3 selected options
by default
.
// If more than 3 options are selected, the number of selected options is printed.
buttonText
:
function
(
options
,
select
)
{
if
(
options
.
length
==
0
)
{
return
this
.
nonSelectedText
+
'
<b class="caret"></b>
'
;
}
else
{
if
(
options
.
length
>
3
)
{
if
(
options
.
length
>
this
.
numberDisplayed
)
{
return
options
.
length
+
'
'
+
this
.
nSelectedText
+
'
<b class="caret"></b>
'
;
}
else
{
...
...
@@ -91,9 +93,21 @@
return
selected
.
substr
(
0
,
selected
.
length
-
2
);
}
},
// Create label
label
:
function
(
element
){
return
$
(
element
).
attr
(
'
label
'
)
||
$
(
element
).
html
();
},
// Is triggered on change of the selected options.
onChange
:
function
(
option
,
checked
)
{
},
// Triggered immediately when dropdown shown
onDropdownShow
:
function
(
event
)
{
},
// Triggered immediately when dropdown hidden
onDropdownHide
:
function
(
event
)
{
},
buttonClass
:
'
btn
'
,
dropRight
:
false
,
...
...
@@ -113,7 +127,8 @@
filterBehavior
:
'
text
'
,
preventInputChangeEvent
:
false
,
nonSelectedText
:
'
None selected
'
,
nSelectedText
:
'
selected
'
nSelectedText
:
'
selected
'
,
numberDisplayed
:
3
},
// Templates.
...
...
@@ -129,6 +144,8 @@
buildContainer
:
function
()
{
this
.
$container
=
$
(
this
.
options
.
buttonContainer
);
this
.
$container
.
on
(
'
show.bs.dropdown
'
,
this
.
options
.
onDropdownShow
);
this
.
$container
.
on
(
'
hide.bs.dropdown
'
,
this
.
options
.
onDropdownHide
);
},
buildButton
:
function
()
{
...
...
@@ -322,7 +339,7 @@
}
// Support the label attribute on options.
var
label
=
$
(
element
).
attr
(
'
label
'
)
||
$
(
element
).
html
(
);
var
label
=
this
.
options
.
label
(
element
);
var
value
=
$
(
element
).
val
();
var
inputType
=
this
.
options
.
multiple
?
"
checkbox
"
:
"
radio
"
;
...
...
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