-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcheckboxes_datalist.html
More file actions
62 lines (57 loc) · 1.72 KB
/
checkboxes_datalist.html
File metadata and controls
62 lines (57 loc) · 1.72 KB
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
58
59
60
61
62
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Working with EasyUI</title>
<link rel="stylesheet" type="text/css" href="./css/default/easyui.css">
<script type="text/javascript" src="./assets/jquery.min.js"></script>
<script type="text/javascript" src="./assets/jquery.easyui.min.js"></script>
</head>
<body>
<h2>Data list</h2>
<p>Showing a list of data.</p>
<div style="margin:20px 0;"></div>
<input id="query" class="easyui-textbox" type="text"/><br><br>
<a id="btn" href="#" class="easyui-linkbutton">Get all checked</a>
<a id="clear" href="#" class="easyui-linkbutton">Clear checked</a><br><br>
<div id="dl">
</div>
<script>
$('#dl').datalist({
url: 'get_countries.php',
checkbox: true,
singleSelect: false,
lines: true,
onClickRow : function(index, row){
alert("this is " + row.text + " = " +row.value);
},
onCheck: function(index, row){
// alert("This row is checked: " + row.value)
}
});
$('#query').textbox({
buttonText:'Search',
iconCls:'icon-man',
iconAlign:'left',
onClickButton : function(e){
var userQuery = $(this).val();
console.log(userQuery);
$('#dl').datalist('reload',{
query : userQuery
});
}
});
$('#btn').on('click',function(){
var checked = $('#dl').datalist('getChecked');
for(var i=0; i<= checked.length-1; i++){
console.log(checked[i].text); // show selected countries
}
return false;
})
$('#clear').on('click',function(){
$('#dl').datalist('clearChecked');
return false;
});
</script>
</body>
</html>