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
e0a994a0
Commit
e0a994a0
authored
Oct 15, 2014
by
David Stutz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Examples for #392.
parent
ae268462
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
207 additions
and
0 deletions
+207
-0
index.html
index.html
+207
-0
No files found.
index.html
View file @
e0a994a0
...
...
@@ -3342,6 +3342,213 @@
</pre>
</div>
<p>
The examples below are aimed to demonstrate the performance of several features when using a large number of options:
</p>
<ul>
<li>
Using the select all option,
<code>
includeSelectAllOption
</code>
set to
<code>
true
</code>
.
</li>
<li>
Additionally using a filter,
<code>
enableFiltering
</code>
set to
<code>
true
</code>
.
</li>
<li>
Additionally using
<code>
enableClickableOptGroups
</code>
.
</li>
<li>
Resetting the multiselect.
</li>
</ul>
<p
class=
"alert alert-warning"
>
The below examples need to be activated.
<b>
Note that this may take some time!
</b><br>
</p>
<p
class=
"alert alert-info"
>
Use
<input
type=
"text"
id=
"example-large-options"
value=
"1000"
style=
"width: 50px;margin: 0px 4px;"
/>
options:
<button
id=
"example-large-enable"
class=
"btn btn-primary"
>
Enable Examples
</button>
</p>
<div
id=
"example-large-error"
>
</div>
<div
class=
"example"
>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
$
(
'
#example-large-enable
'
).
on
(
'
click
'
,
function
()
{
var
options
=
$
(
'
#example-large-options
'
).
val
();
if
(
options
<
1
||
options
>
5000
)
{
$
(
'
#example-large-error
'
).
html
(
'
<p class="alert alert-error">Choose between 1 and 5000 options!</p>
'
);
}
else
{
$
(
'
#example-large-includeSelectAllOption
'
).
html
(
''
);
$
(
'
#example-large-includeSelectAllOption-enableFiltering
'
).
html
(
''
);
$
(
'
#example-large-includeSelectAllOption-enableFiltering-enableClickableOptGroups
'
).
html
(
''
);
$
(
'
#example-large-reset
'
).
html
(
''
);
for
(
var
j
=
0
;
j
<
options
;
j
++
)
{
i
=
j
+
1
;
$
(
'
#example-large-includeSelectAllOption
'
).
append
(
'
<option value="
'
+
i
.
toString
()
+
'
">Option
'
+
i
.
toString
()
+
'
</option>
'
);
$
(
'
#example-large-includeSelectAllOption-enableFiltering
'
).
append
(
'
<option value="
'
+
i
.
toString
()
+
'
">Option
'
+
i
.
toString
()
+
'
</option>
'
);
var
group
=
Math
.
floor
(
j
/
10
)
+
1
;
var
number
=
j
%
10
+
1
;
if
(
number
===
1
)
{
$
(
'
#example-large-includeSelectAllOption-enableFiltering-enableClickableOptGroups
'
).
append
(
'
<optgroup label="Group
'
+
group
.
toString
()
+
'
"></optgroup>
'
);
}
$
(
'
#example-large-includeSelectAllOption-enableFiltering-enableClickableOptGroups
'
).
append
(
'
<option value="
'
+
group
.
toString
()
+
'
-
'
+
number
.
toString
()
+
'
">Option
'
+
group
.
toString
()
+
'
.
'
+
number
.
toString
()
+
'
</option>
'
);
$
(
'
#example-large-reset
'
).
append
(
'
<option value="
'
+
i
.
toString
()
+
'
">Option
'
+
i
.
toString
()
+
'
</option>
'
);
}
$
(
'
#example-large-includeSelectAllOption
'
).
multiselect
({
maxHeight
:
200
,
includeSelectAllOption
:
true
});
$
(
'
#example-large-includeSelectAllOption-enableFiltering
'
).
multiselect
({
maxHeight
:
200
,
includeSelectAllOption
:
true
,
enableFiltering
:
true
});
$
(
'
#example-large-includeSelectAllOption-enableFiltering-enableClickableOptGroups
'
).
multiselect
({
maxHeight
:
200
,
includeSelectAllOption
:
true
,
enableFiltering
:
true
,
enableClickableOptGroups
:
true
});
$
(
'
#example-large-reset
'
).
multiselect
({
maxHeight
:
200
,
includeSelectAllOption
:
true
});
$
(
'
#example-large-reset-form
'
).
on
(
'
reset
'
,
function
()
{
$
(
'
#example-large-reset
'
).
multiselect
(
'
deselectAll
'
,
false
);
$
(
'
#example-large-reset
'
).
multiselect
(
'
updateButtonText
'
);
});
}
});
});
</script>
<div
class=
"btn-toolbar"
style=
"margin-bottom:12px;"
>
<div
class=
"btn-group"
>
<select
id=
"example-large-includeSelectAllOption"
multiple=
"multiple"
>
<option
value=
"1"
>
Option 1
</option>
</select>
</div>
</div>
<div
class=
"btn-toolbar"
style=
"margin-bottom:12px;"
>
<div
class=
"btn-group"
>
<select
id=
"example-large-includeSelectAllOption-enableFiltering"
multiple=
"multiple"
>
<option
value=
"1"
>
Option 1
</option>
</select>
</div>
</div>
<div
class=
"btn-toolbar"
style=
"margin-bottom:12px;"
>
<div
class=
"btn-group"
>
<select
id=
"example-large-includeSelectAllOption-enableFiltering-enableClickableOptGroups"
multiple=
"multiple"
>
<option
value=
"1"
>
Option 1
</option>
</select>
</div>
</div>
<form
id=
"example-large-reset-form"
style=
"margin-bottom:12px;"
>
<div
class=
"btn-group"
>
<select
id=
"example-large-reset"
multiple=
"multiple"
>
<option
value=
"1"
>
Option 1
</option>
</select>
<button
type=
"reset"
class=
"btn btn-default"
>
Reset
</button>
</div>
</form>
</div>
<div
class=
"highlight"
>
<pre
class=
"prettyprint linenums"
>
<
script type=
"
text/javascript
">
$(document).ready(function() {
$('#example-large-enable').on('click', function() {
var options = $('#example-large-options').val();
if (options
<
1 || options
>
5000) {
$('#example-large-error').html('
<
p class=
"
alert alert-error
">
Choose between 1 and 5000 options!
<
/p
>
');
}
else {
$('#example-large-includeSelectAllOption').html('');
$('#example-large-includeSelectAllOption-enableFiltering').html('');
$('#example-large-includeSelectAllOption-enableFiltering-enableClickableOptGroups').html('');
$('#example-large-reset').html('');
for (var j = 0; j
<
options; j++) {
i = j + 1;
$('#example-large-includeSelectAllOption').append('
<
option value=
"
' + i.toString() + '
">
Option ' + i.toString() + '
<
/option
>
');
$('#example-large-includeSelectAllOption-enableFiltering').append('
<
option value=
"
' + i.toString() + '
">
Option ' + i.toString() + '
<
/option
>
');
var group = Math.floor(j/10) + 1;
var number = j % 10 + 1;
if (number === 1) {
$('#example-large-includeSelectAllOption-enableFiltering-enableClickableOptGroups').append('
<
optgroup label=
"
Group ' + group.toString() + '
"><
/optgroup
>
');
}
$('#example-large-includeSelectAllOption-enableFiltering-enableClickableOptGroups').append('
<
option value=
"
' + group.toString() + '-' + number.toString() + '
">
Option ' + group.toString() + '.' + number.toString() + '
<
/option
>
');
$('#example-large-reset').append('
<
option value=
"
' + i.toString() + '
">
Option ' + i.toString() + '
<
/option
>
');
}
$('#example-large-includeSelectAllOption').multiselect({
maxHeight: 200,
includeSelectAllOption: true
});
$('#example-large-includeSelectAllOption-enableFiltering').multiselect({
maxHeight: 200,
includeSelectAllOption: true,
enableFiltering: true
});
$('#example-large-includeSelectAllOption-enableFiltering-enableClickableOptGroups').multiselect({
maxHeight: 200,
includeSelectAllOption: true,
enableFiltering: true,
enableClickableOptGroups: true
});
$('#example-large-reset').multiselect({
maxHeight: 200,
includeSelectAllOption: true
});
$('#example-large-reset-form').on('reset', function() {
$('#example-large-reset').multiselect('deselectAll', false);
$('#example-large-reset').multiselect('updateButtonText');
});
}
});
});
<
/script
>
<
div class=
"
btn-toolbar
"
style=
"
margin-bottom:12px;
">
<
div class=
"
btn-group
">
<
select id=
"
example-large-includeSelectAllOption
"
multiple=
"
multiple
">
<
option value=
"
1
">
Option 1
<
/option
>
<
/select
>
<
/div
>
<
/div
>
<
div class=
"
btn-toolbar
"
style=
"
margin-bottom:12px;
">
<
div class=
"
btn-group
">
<
select id=
"
example-large-includeSelectAllOption-enableFiltering
"
multiple=
"
multiple
">
<
option value=
"
1
">
Option 1
<
/option
>
<
/select
>
<
/div
>
<
/div
>
<
div class=
"
btn-toolbar
"
style=
"
margin-bottom:12px;
">
<
div class=
"
btn-group
">
<
select id=
"
example-large-includeSelectAllOption-enableFiltering-enableClickableOptGroups
"
multiple=
"
multiple
">
<
option value=
"
1
">
Option 1
<
/option
>
<
/select
>
<
/div
>
<
/div
>
<
form id=
"
example-large-reset-form
"
style=
"
margin-bottom:12px;
">
<
div class=
"
btn-group
">
<
select id=
"
example-large-reset
"
multiple=
"
multiple
">
<
option value=
"
1
">
Option 1
<
/option
>
<
/select
>
<
button type=
"
reset
"
class=
"
btn btn-default
">
Reset
<
/button
>
<
/div
>
<
/form
>
</pre>
</div>
<div
class=
"page-header"
>
<h2
id=
"post"
>
Server-Side Processing
</h2>
</div>
...
...
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