forked from vitmalina/w2ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrid-10.html
48 lines (46 loc) · 2.42 KB
/
grid-10.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
<div class="content">
<div id="example_title">
<h1>Select/Unselect Records</h1>
It is important for any project to be able to work with selection easily. This example demonstrate the use of several methods
that allow you to select, unselect and get selected records from the grid.
</div>
<div id="example_view"></div>
<div id="example_code"></div>
</div>
<!--CODE-->
<div id="grid" style="width: 100%; height: 250px;"></div>
<br>
<input type="button" value="Select All" onclick="w2ui.grid.selectAll();">
<input type="button" value="Select None" onclick="w2ui.grid.selectNone();">
<input type="button" value="Select a Record" onclick="w2ui.grid.select(5);">
<input type="button" value="Deselect a Record" onclick="w2ui.grid.unselect(5);">
<input type="button" value="Select Several" onclick="w2ui.grid.select(5,3,7);">
<input type="button" value="Get Selection" onclick="alert(w2ui.grid.getSelection());">
<!--CODE-->
<script>
$(function () {
$('#grid').w2grid({
name: 'grid',
show: {
selectColumn: true
},
columns: [
{ field: 'recid', caption: 'ID', size: '30px', sortable: true, attr: 'align="center"' },
{ field: 'lname', caption: 'Last Name', size: '30%', sortable: true },
{ field: 'fname', caption: 'First Name', size: '30%', sortable: true },
{ field: 'email', caption: 'Email', size: '40%', sortable: true },
{ field: 'sdate', caption: 'Start Date', size: '90px', sortable: true },
],
records: [
{ recid: 1, fname: 'John', lname: 'doe', email: '[email protected]', sdate: '4/3/2012' },
{ recid: 2, fname: 'Stuart', lname: 'Motzart', email: '[email protected]', sdate: '4/3/2012' },
{ recid: 3, fname: 'Jin', lname: 'Franson', email: '[email protected]', sdate: '4/3/2012' },
{ recid: 4, fname: 'Susan', lname: 'Ottie', email: '[email protected]', sdate: '4/3/2012' },
{ recid: 5, fname: 'Kelly', lname: 'Silver', email: '[email protected]', sdate: '4/3/2012' },
{ recid: 6, fname: 'Francis', lname: 'Gatos', email: '[email protected]', sdate: '4/3/2012' },
{ recid: 7, fname: 'Mark', lname: 'Welldo', email: '[email protected]', sdate: '4/3/2012' },
{ recid: 8, fname: 'Thomas', lname: 'Bahh', email: '[email protected]', sdate: '4/3/2012' }
]
});
});
</script>