-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformlisting.html
138 lines (102 loc) · 4.17 KB
/
formlisting.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
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="css/bootstrap-theme.min.css" crossorigin="anonymous">
<link href="css/starter-template.css" rel="stylesheet">
<!-- Latest compiled and minified JavaScript -->
<script src="js/bootstrap.min.js" crossorigin="anonymous"></script>
<script>
$(document).ready(function () {
var mytable = $('#example').DataTable({
"paging": true,
"lengthChange": false,
"searching": false,
"ordering": true,
"info": true,
"autoWidth": false,
"sDom": 'lfrtip'
});
$("button").click(function () {
mytable.clear();
mytable.draw();
alert("canvas clear");
$.ajax({
url: 'https://api.masterdatanode.com/demo/formdata/find',
type: 'get',
data: {
},
headers: {
"access_token": 'Zs0nTQB-ujOSV0KmEoPhBx2E6-Ab_GKO',
"Content-Type": 'application/json'
},
dataType: 'json',
success: function (data) {
console.info(JSON.stringify(data));
//$("#test_div").html(JSON.stringify(data));
$("#test_div").show();
var obj = JSON.parse(JSON.stringify(data));
/* for(var i = 0; i < obj.result.length; i++) {
var obj1 = data[i];
console.log(obj1.id);
} */
//var mytable = $('#example').DataTable();
var result = $.parseJSON(JSON.stringify(obj.result));
$.each(result, function(k, jsonObject) {
//display the key and value pair
//alert(k + ' is ' + jsonObject);
var result12 = [];
result12.push(jsonObject.name);
result12.push(jsonObject.email);
result12.push(jsonObject.username);
result12.push(jsonObject.created_date);
result12.push(jsonObject.name);
result12.push(jsonObject.email);
result12.push(jsonObject.name);
// .... add all the values required
console.info(result12);
//var jsdata = JSON.parse(v);
mytable.row.add(result12);
});
mytable.draw();
//mytable.draw();
console.info(JSON.stringify(obj.result));
}
});
});
});
</script>
</head>
<body>
<div class="container starter-template">
<div >
<h1>HTML and MasterDataNode</h1>
<p class="lead">With MasterDataNode you don't require server<br> A standalone html page with CSS and JS, suffice to build an application</p>
</div>
<div >
<button class="btn btn-info">Send an HTTP table find request</button>
</div>
<div class=" col-lg-12 " >
Only 10 data get display out of totalCount
</div>
<div id="test_div" style="display:none" class="col-lg-12">
<table id="example" class="table" width="100%">
<thead>
<tr>
<th>code</th>
<th>Name</th>
<th>Description</th>
<th>Image</th>
<th>Parent</th>
<th>Location</th>
<th>Category</th>
</tr>
</table>
</div>
</div>
</body>
</html>