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
6eb86d07
Commit
6eb86d07
authored
Oct 03, 2013
by
David Stutz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Example for #163.
parent
13219440
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
8 deletions
+48
-8
index.html
index.html
+44
-7
bootstrap-multiselect.js
js/bootstrap-multiselect.js
+4
-1
No files found.
index.html
View file @
6eb86d07
...
...
@@ -802,14 +802,14 @@ $("#multiselect").multiselect('dataprovider', data);
case
2
:
rebuildMultiselect
(
firstConfigurationSet
);
$
(
this
).
text
(
'
Configuration Set
1
'
);
$
(
this
).
text
(
'
Configuration Set
2
'
);
set
=
1
;
break
;
case
1
:
default
:
rebuildMultiselect
(
secondConfigurationSet
);
$
(
this
).
text
(
'
Configuration Set
2
'
);
$
(
this
).
text
(
'
Configuration Set
1
'
);
set
=
2
;
break
;
...
...
@@ -820,7 +820,7 @@ $("#multiselect").multiselect('dataprovider', data);
<table
class=
"table table-striped"
>
<tbody>
<tr>
<td
style=
"width:3
0
0px"
>
<td
style=
"width:3
5
0px"
>
<div
class=
"btn-group"
>
<select
id=
"example21"
multiple=
"multiple"
>
<option
value=
"cheese"
>
Cheese
</option>
...
...
@@ -922,9 +922,11 @@ $("#multiselect").multiselect('dataprovider', data);
buttonText: function(options) {
if (options.length == 0) {
return 'None selected
<
b class=
"
caret
"><
/b
>
';
} else if (options.length
>
6) {
}
else if (options.length
>
6) {
return options.length + ' selected
<
b class=
"
caret
"><
/b
>
';
} else {
}
else {
var selected = '';
options.each(function() {
selected += $(this).text() + ', ';
...
...
@@ -935,10 +937,12 @@ $("#multiselect").multiselect('dataprovider', data);
onChange: function(element, checked) {
if(checked == true) {
// action taken here if true
} else if (checked == false) {
}
else if (checked == false) {
if (confirm('Do you wish to deselect the element?')) {
// action taken here
} else {
}
else {
$(
"
#example22
"
).multiselect('select', element.val());
return false;
}
...
...
@@ -964,6 +968,39 @@ $("#multiselect").multiselect('dataprovider', data);
<button
id=
"example33-configuration-set"
class=
"btn btn-primary"
>
Configuration Set 2
</button>
</div>
</td>
<td>
<pre
class=
"linenums prettyprint"
>
<
script type=
"
text/javascript
">
$(document).ready(function() {
var set = 1;
$('#example33').multiselect(firstConfigurationSet);
function rebuildMultiselect(options) {
$('#example33').multiselect('setOptions', options);
$('#example33').multiselect('rebuild');
}
$('#example33-configuration-set').on('click', function(event) {
switch (set) {
case 2:
rebuildMultiselect(firstConfigurationSet);
$(this).text('Configuration Set 2');
set = 1;
break;
case 1:
default:
rebuildMultiselect(secondConfigurationSet);
$(this).text('Configuration Set 1');
set = 2;
break;
}
});
});
<
/script
>
</pre>
</td>
</tr>
</tbody>
</table>
...
...
js/bootstrap-multiselect.js
View file @
6eb86d07
...
...
@@ -367,7 +367,7 @@
// Add the select all option to the select.
buildSelectAll
:
function
()
{
var
alreadyHasSelectAll
=
this
.
$select
[
0
][
0
]
?
this
.
$select
[
0
][
0
].
value
==
this
.
options
.
selectAllValue
:
false
;
console
.
log
(
this
.
options
);
// If options.includeSelectAllOption === true, add the include all checkbox.
if
(
this
.
options
.
includeSelectAllOption
&&
this
.
options
.
multiple
&&
!
alreadyHasSelectAll
)
{
this
.
$select
.
prepend
(
'
<option value="
'
+
this
.
options
.
selectAllValue
+
'
">
'
+
this
.
options
.
selectAllText
+
'
</option>
'
);
...
...
@@ -532,6 +532,9 @@
rebuild
:
function
()
{
this
.
$ul
.
html
(
''
);
// Remove select all option in select.
$
(
'
option[value="
'
+
this
.
options
.
selectAllValue
+
'
"]
'
,
this
.
$select
).
remove
();
// Important to distinguish between radios and checkboxes.
this
.
options
.
multiple
=
this
.
$select
.
attr
(
'
multiple
'
)
==
"
multiple
"
;
...
...
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