-
Notifications
You must be signed in to change notification settings - Fork 2
/
demo.html
169 lines (147 loc) · 4.99 KB
/
demo.html
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<!doctype html>
<html lang=en>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery Selectables Plugin Demo</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<style>
body
{
padding-top: 70px;
}
*.unselectable
{
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.table-striped > tbody > tr:nth-child(odd).selected > td
{
background-color: #9FAFD1;
}
.table-striped > tbody > tr:nth-child(even).selected > td
{
background-color: #B0BED9;
}
.table-striped > tbody > tr:nth-child(odd).bnw > td
{
background-color: #2b2b2b;
color: #f2f2f2;
}
.table-striped > tbody > tr:nth-child(even).bnw > td
{
background-color: #f2f2f2;
color: #2b2b2b;
}
</style>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!--[if !IE]>-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!--<![endif]-->
<!--[if IE]>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<![endif]-->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="jquery.rowselector.min.js"></script>
<script>
$(document).ready(function ()
{
$('#config-form').on('submit', function (evt)
{
evt.preventDefault();
});
$('#btn-show').on('click', function (evt)
{
var selected = [];
$('#user-table').selectedrows().each(function (idx, el)
{
selected.push(el.id);
});
alert('Selected Ids:\n' + selected.join(', '));
});
$('#select-type').on('change', function (evt)
{
$('#user-table').attr('data-rs-type', $(this).val());
});
$('#select-class').on('change', function (evt)
{
$('#user-table').attr('data-rs-class', $(this).val());
});
$('#user-table').on('clicked.rs.row', function (evt)
{
var rows = $(this).selectedrows().length;
$('#num-selected').text(rows);
});
});
</script>
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand">Row Selector + Bootstrap Demo</a>
</div>
<form id="config-form" class="navbar-form navbar-left" role="form">
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">data-rs-type</div>
<select id="select-type" class="form-control input-sm">
<option value="many">many</option>
<option value="one">one</option>
<option value="none">none</option>
</select>
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">data-rs-class</div>
<select id="select-class" class="form-control input-sm">
<option value="selected">selected (default)</option>
<option value="bnw">bnw (Black and white)</option>
</select>
</div>
</div>
<button type="button" id="btn-show" class="btn btn-primary btn-sm">Selected Ids</button>
</form>
</div>
</div>
<div class="container">
<div class="row">
<h4>Selected: <span id="num-selected">0</span></h4>
<table id="user-table" data-rs-selectable data-rs-type="many" class="table table-striped" cellpadding=0 cellspacing=0 border=0>
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr id="0"><td>0</td><td>James</td><td>Smith</td><td>jsmith</td></tr>
<tr id="1"><td>1</td><td>John</td><td>Johnson</td><td>jjohnson</td></tr>
<tr id="2"><td>2</td><td>Robert</td><td>Williams</td><td>rwilliams</td></tr>
<tr id="3"><td>3</td><td>Michael</td><td>Jones</td><td>mjones</td></tr>
<tr id="4"><td>4</td><td>Wiliam</td><td>Brown</td><td>wbrown</td></tr>
<tr id="5"><td>5</td><td>David</td><td>Davis</td><td>ddavis</td></tr>
<tr id="6"><td>6</td><td>Richard</td><td>Miller</td><td>rmiller</td></tr>
<tr id="7"><td>7</td><td>Charles</td><td>Wilson</td><td>cwilson</td></tr>
<tr id="8"><td>8</td><td>Joseph</td><td>Moore</td><td>jmoore</td></tr>
<tr id="9"><td>9</td><td>Thomas</td><td>Taylor</td><td>ttaylor</td></tr>
</tbody>
</table>
</div>
</div>
</body>
</html>