-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathselect2.cfm
57 lines (53 loc) · 2.37 KB
/
select2.cfm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html lang="en">
<head>
<!-- META SECTION -->
<title>Atlant - Responsive Bootstrap Admin Template</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<!-- END META SECTION -->
<!-- CSS INCLUDE -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css" rel="stylesheet" />
<!-- EOF CSS INCLUDE -->
</head>
<body>
<form id="fName" role="form" class="form-horizontal" method="post" action="">
<div class="form-group">
<label class="col-md-3 control-label">Select2</label>
<div class="col-md-9">
<input type="hidden" name="select2" id="select2" class="form-control" value="">
</div>
</div>
</form>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.min.js"></script>
</body>
</html>
<script type="text/javascript">
jQuery(document).ready(function () {
$("#select2").select2({
minimumInputLength: 3,
allowClear: true,
ajax: { // instead of writing the function to execute the request we use Select2's convenient helper
url: "select2.cfc?returnformat=json", //myComponents.cfm is coldfusion component name
dataType: 'json',
quietMillis: 250,
data: function (term, page) {
return {
method: "find", // functionName
key: term, // search term
page_limit: 10, //Limit found
page: page
};
},
results: function (data, page) {
var more = (page * 10) < data.total;
return { results: data.clients, more: more };
}
}
});
});
</script>