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
fb70b2ad
Commit
fb70b2ad
authored
Oct 13, 2014
by
David Stutz
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #388 from scenting/master
#305, #302. Added enableClickableOptGroups option.
parents
ba72c358
1c9d0f7b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
0 deletions
+64
-0
index.html
index.html
+43
-0
bootstrap-multiselect.js
js/bootstrap-multiselect.js
+21
-0
No files found.
index.html
View file @
fb70b2ad
...
...
@@ -246,6 +246,10 @@ $(document).ready(function() {
$
(
'
#example53-deselect
'
).
on
(
'
click
'
,
function
()
{
$
(
'
#example53
'
).
multiselect
(
'
deselect
'
,
'
cheese
'
);
});
$
(
'
#example54
'
).
multiselect
({
enableClickableOptGroups
:
true
});
});
</script>
...
...
@@ -524,6 +528,28 @@ $(document).ready(function() {
Option groups and options without any group are supported simultaneously.
</td>
</tr>
<tr>
<td>
<select
id=
"example54"
multiple=
"multiple"
>
<optgroup
label=
"Mathematics"
>
<option
value=
"analysis"
>
Analysis
</option>
<option
value=
"algebra"
>
Linear Algebra
</option>
<option
value=
"discrete"
>
Discrete Mathematics
</option>
<option
value=
"numerical"
>
Numerical Analysis
</option>
<option
value=
"probability"
>
Probability Theory
</option>
</optgroup>
<optgroup
label=
"Computer Science"
>
<option
value=
"programming"
>
Introduction to Programming
</option>
<option
value=
"automata"
>
Automata Theory
</option>
<option
value=
"complexity"
>
Complexity Theory
</option>
<option
value=
"software"
>
Software Engineering
</option>
</optgroup>
</select>
</td>
<td>
Use
<code>
enableClickableOptGroups
</code>
to make optgroup headers clickable to select / deselect all options inside an optgroup.
</td>
</tr>
<tr>
<td>
<select
id=
"example20"
multiple=
"multiple"
>
...
...
@@ -1161,6 +1187,23 @@ $(document).ready(function() {
disableIfEmpty: true
});
});
<
/script
>
</pre>
</td>
</tr>
<tr>
<td><code>
enableClickableOptGroups
</code></td>
<td>
Set to
<code>
true
</code>
to make optgroup headers clickable to select/deselect options.
</td>
<td>
<pre
class=
"prettyprint linenums"
>
<
script type=
"
text/javascript
">
$(document).ready(function() {
$(
'
.multiselect
'
).multiselect({
enableClickableOptGroups: true
});
});
<
/script
>
</pre>
</td>
...
...
js/bootstrap-multiselect.js
View file @
fb70b2ad
...
...
@@ -242,6 +242,7 @@
selectAllValue
:
'
multiselect-all
'
,
enableFiltering
:
false
,
enableCaseInsensitiveFiltering
:
false
,
enableClickableOptGroups
:
false
,
filterPlaceholder
:
'
Search
'
,
// possible options: 'text', 'value', 'both'
filterBehavior
:
'
text
'
,
...
...
@@ -527,6 +528,26 @@
event
.
preventDefault
();
}
},
this
));
if
(
this
.
options
.
enableClickableOptGroups
&&
this
.
options
.
multiple
)
{
$
(
'
li.group
'
,
this
.
$ul
).
on
(
'
click
'
,
$
.
proxy
(
function
(
event
)
{
event
.
stopPropagation
();
var
group
=
$
(
event
.
target
).
parent
();
// Search all option in optgroup
var
$options
=
group
.
nextUntil
(
'
li.group
'
);
// check or uncheck items
var
allChecked
=
true
;
var
optionInputs
=
$options
.
find
(
'
input
'
);
optionInputs
.
each
(
function
()
{
allChecked
=
allChecked
&&
$
(
this
).
prop
(
'
checked
'
);
});
optionInputs
.
prop
(
'
checked
'
,
!
allChecked
).
trigger
(
'
change
'
);
},
this
));
}
},
/**
...
...
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