forked from vitmalina/w2ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrid-5.html
49 lines (45 loc) · 2.17 KB
/
grid-5.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
<div class="content">
<div id="example_title">
<h1>Load Data Once</h1>
If you define the url property, then each type a new page is opened it will submit a request to the server for the new portion
of the data. However, if you use the load() method, it will load data from the URL, but only once. The grid will think it has local
data source and will not send any more server side requests.
</div>
<div id="example_view"></div>
<div id="example_code"></div>
</div>
<!--CODE-->
<div id="grid" style="width: 100%; height: 350px; overflow: hidden;"></div>
<!--CODE-->
<script>
$(function () {
$('#grid').w2grid({
name: 'grid',
columns: [
{ 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: '120px', sortable: true },
]
});
w2ui['grid'].load('data/list.json');
});
</script>
<!--CODE-->
<!--CODE-->
<script type="text/json">
{
"total": 9,
"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" },
{ "recid": 9, "fname": "Sergei", "lname": "Rachmaninov", "email": "[email protected]", "sdate": "4/3/2012" }
]
}
</script>