1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-13 23:49:04 +01:00
OwncloudContactsOfficial/vendor/ui-multiselect/demos/callbacks.htm

113 lines
3.6 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery MultiSelect Widget Demo</title>
<link rel="stylesheet" type="text/css" href="../jquery.multiselect.css" />
<link rel="stylesheet" type="text/css" href="assets/style.css" />
<link rel="stylesheet" type="text/css" href="assets/prettify.css" />
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/ui-lightness/jquery-ui.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
<script type="text/javascript" src="../src/jquery.multiselect.js"></script>
<script type="text/javascript" src="assets/prettify.js"></script>
<script type="text/javascript">
$(function(){
var $callback = $("#callback");
$("select").multiselect({
click: function(event, ui){
$callback.text(ui.value + ' ' + (ui.checked ? 'checked' : 'unchecked') );
},
beforeopen: function(){
$callback.text("Select about to be opened...");
},
open: function(){
$callback.text("Select opened!");
},
beforeclose: function(){
$callback.text("Select about to be closed...");
},
close: function(){
$callback.text("Select closed!");
},
checkAll: function(){
$callback.text("Check all clicked!");
},
uncheckAll: function(){
$callback.text("Uncheck all clicked!");
},
optgrouptoggle: function(event, ui){
var values = $.map(ui.inputs, function(checkbox){
return checkbox.value;
}).join(", ");
$callback.html("<strong>Checkboxes " + (ui.checked ? "checked" : "unchecked") + ":</strong> " + values);
}
});
});
</script>
</head>
<body onload="prettyPrint();">
<h2>Callbacks &amp; Events</h2>
<p>Demonstrating beforeopen, open, beforeclose, close, click, checkall, uncheckall, and optgrouptoggle callbacks/events. Note that you can either
pass in an event handler in the options object upon initialization, or bind to the event (including the multiselect prefix). For example, to add an
"open" handler, you can also use <code class="prettyprint">$("select").bind("multiselectopen", fn);</code></p>
<p class="message success" id="callback">Callback target</p>
<select multiple="multiple" size="5">
<optgroup label="Group One">
<option value="option1">Option 1</option>
<option value="option2">Option 2</option>
<option value="option3">Option 3</option>
</optgroup>
<optgroup label="Group Two">
<option value="option4">Option 4</option>
<option value="option5">Option 5</option>
<option value="option6">Option 6</option>
<option value="option7">Option 7</option>
</optgroup>
</select>
<pre class="prettyprint">
var $callback = $("#callback");
$("select").multiselect({
click: function(event, ui){
$callback.text(ui.value + ' ' + (ui.checked ? 'checked' : 'unchecked') );
},
beforeopen: function(){
$callback.text("Select about to be opened...");
},
open: function(){
$callback.text("Select opened!");
},
beforeclose: function(){
$callback.text("Select about to be closed...");
},
close: function(){
$callback.text("Select closed!");
},
checkAll: function(){
$callback.text("Check all clicked!");
},
uncheckAll: function(){
$callback.text("Uncheck all clicked!");
},
optgrouptoggle: function(event, ui){
var values = $.map(ui.inputs, function(checkbox){
return checkbox.value;
}).join(", ");
$callback.html("<strong>Checkboxes " + (ui.checked ? "checked" : "unchecked") + ":</strong> " + values);
}
});
</pre>
</body>
</html>