This repository has been archived by the owner on Jan 10, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.html
executable file
·181 lines (177 loc) · 5.52 KB
/
index.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
170
171
172
173
174
175
176
177
178
179
180
181
<!DOCTYPE html>
<html>
<head>
<title>GigaTables example</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="jquery.js"></script>
<script src="src/js/jquery.gigatables.js"></script>
<link href="src/css/jquery.gigatables.css" rel="stylesheet" type="text/css"/>
<script src="src/js/gigatables.editor.js"></script>
<link href="src/css/gigatables.editor.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<script>
$(function () {
var editor = new $.fn.GigaTable.Editor({
ajax: 'editor.php',
ajaxFiles: 'uploadFiles.php',
struct: {
buttons: ['top', 'bottom'] // buttons
},
fields: [
{
label: "ID",
name: "id",
type: 'hidden'
},
{// an example of using select - automatically selected if matches with data in table column
label: "Types:",
name: "types[]",
values: [// if select,checkbox,radio etc types - need this kinda structure of value
{'key1': 'val1'},
{'key2': 'val2'}
],
type: 'checkbox', // select,checkbox,radio
// attrs: [
// {'multiple':true}
// ]
},
{
label: "Article title:",
name: "title",
type: 'text', // default, other: password, file, select, multiselect etc
attrs: [
{'pattern': '^[A-Za-z0-9_]+$'}
]
},
{
label: "Description:",
name: "desc",
type: 'textarea'
},
{
label: "Date Time:",
name: "date",
type: 'date'
},
{
label: "Image:",
name: "image",
type: 'file'
},
]
});
// var edito = null;
// minimal config
// $('#gigatable').GigaTable({
// struct: {// all in
// search: [],
// rowsSelector: [],
// pagination: [] // turn off pagination
// },
// ajax: 'gigatables.php',
// columns: [
// {data: "id"},
// {data: "desc"},
// {data: "title"},
// {data: "date"},
// {data: "info"}
// ]
// });
$('#gigatable').GigaTable({
struct: {// all in
search: ['top', 'bottom'],
rowsSelector: ['asc', 'top', 'bottom'],
pagination: ['bottom']
},
lang: 'en', // english default
perPageRows: [25, 50, 100, 200, 500],
defaultPerPage: 50,
ajax: 'gigatables.php',
requestType: 'POST',
columns: [
{// include all defaults
data: "id",
sortable: true,
visible: true,
searchable: true,
discreteSearch: true, // false by default
discreteSearchValue: function (title) {
return 'Поиск по полю ' + title;
}
},
// {data: "title"},
{data: "desc", sortable: false},
{
data: "date",
searchable: false
},
{
data: "info",
// visible: false
},
{data:"field1"},
{data:"field2"},
{data:"field3"}
],
columnOpts: [
{
render: function (data, row, type) {
return '<div><form method="post" class="accForm" action=""><input type="hidden" name="action" value="forms" /><input type="hidden" name="id" value="' + row.id + '" /><div>' + data + '</div></form></div>';
},
target: 2
},
{
render: function (data, row, type) {
return '<div><form method="post" class="accForm" action=""><input type="hidden" name="action" value="forms" /><input type="hidden" name="id" value="' + row.id + '" /><div>' + data + '</div></form></div>';
},
target: 3
}
],
tableOpts: {
buttons: [
{extended: "editor_create", editor: editor, triggerAfter: (function () {
console.log('after create');
}), triggerBefore: (function () {
console.log('before create');
})},
{extended: "editor_edit", editor: editor},
{extended: "editor_remove", editor: editor, triggerAfter: (function () {
console.log('after del');
})}
],
buttonsPosition: ['top', 'bottom'],
theme: 'std'
}
});
});
</script>
<table id="gigatable">
<thead>
<tr>
<th>ID</th>
<!--<th>Name</th>-->
<th>Description</th>
<th>Date</th>
<th>Info</th>
<th>Field 1 the long field title</th>
<th>Field 2</th>
<th>Field 3</th>
</tr>
</thead>
<tfoot>
<tr>
<th>ID</th>
<!--<th>Name</th>-->
<th>Description</th>
<th>Date</th>
<th>Info</th>
<th>Field 1 the long field title</th>
<th>Field 2</th>
<th>Field 3</th>
</tr>
</tfoot>
</table>
</body>
</html>