-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.html
169 lines (150 loc) · 5.86 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
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<title>Table Edit</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<style>
body{font-size:12px; font-family:verdana; font-color:#333;}
body h1{color:#069; text-align: center;}
body p{width:850px; margin:auto; position:relative; text-align:center; }
body #code{width:950px; margin:auto;}
body table{border:0px; align:center;}
body table thead tr th{background:#333; color:#fff; padding:3px 10px;}
body table tbody tr td{background:#ececec; padding:3px 10px;}
body table tbody tr td input{border:1px solid #ccc;}
body table tbody tr td a{color:#069; text-decoration: none;}
body table tbody tr td a:hover{color:red; text-decoration: none;}
body xmp{border:1px solid #999; border-radius:10px; padding:10px; color:#333; float:left; clear: both;}
footer{float:left; width:100%; padding:30px 0px; text-align: center; line-height:25px;}
</style>
<script src="js/jquery-2.1.0.min.js"></script>
<script src="js/tableEdit-0.1.js"></script>
<script>
$(function(){
$("#tableEdit").tableEdit({
columnsTr: "2,3",
enableDblClick: true, //enable edit td with dblclick
callback: function(e){
console.log(e.city);
console.log(e.age);
/*
* code for ajax
*/
},
activeMasks: function(){
console.log("function enable masks");
/*
* function for active masks
*/
}
});
})
</script>
</head>
<body>
<h1>Table Edit</h1>
<p>
How to use?
<div id="code">
<xmp>
<head>
<!-- jquery framework load -->
<script src="js/jquery-2.1.0.min.js"></script>
<!-- plugin tableEdit load -->
<script src="js/tableEdit-0.1.js"></script>
<!-- load plugin for element -->
<script>
$(function(){
$("#tableEdit").tableEdit({
columnsTr: "2,3", //null = all columns editable
enableDblClick: true, //enable edit td with dblclick
callback: function(e){
console.log(e.city);
console.log(e.age);
/*
* code for ajax
*/
},
activeMasks: function(){
console.log("function enable masks");
/*
* function for active masks
*/
}
});
})
</script>
</head>
<body>
<table id="tableEdit" align="center" >
<thead>
<tr>
<th>Edit</th>
<th>Name</th>
<th>Age</th>
<th>City</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="javascript:;" class="btEdit">Edit</a></td> <!-- class btEdit to button edit this row -->
<td ref="type:text, name:nome, class:nomeClasse, id:nomeId">Samuel</td> <!-- ref define all attributes of new input -->
<td ref="type:text, name:age, class:ageClasse, id:ageId">26</td> <!-- ref define all attributes of new input -->
<td ref="type:text, name:city, class:cityClasse, id:cityId">Jundiaí</td> <!-- ref define all attributes of new input -->
</tr>
<tr>
<td><a href="javascript:;" class="btEdit">Edit</a></td>
<td>Joana</td>
<td>28</td>
<td>Campinas</td>
</tr>
</tbody>
</table>
</body>
</xmp>
</div>
</p>
<br style="clear: both;">
<div id="sample1">
<table id="tableEdit" align="center">
<thead>
<tr>
<th>Edit</th>
<th>Name</th>
<th>Age</th>
<th>City</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="javascript:;" class="btEdit">Edit</a></td>
<td ref="type:text, name:nome, class:nomeClasse, id:nomeId">Samuel</td> <!-- ref define all attributes of new input -->
<td ref="type:text, name:age, class:ageClasse, id:ageId">26</td> <!-- ref define all attributes of new input -->
<td ref="type:text, name:city, class:cityClasse, id:cityId">Jundiaí</td> <!-- ref define all attributes of new input -->
</tr>
<tr>
<td><a href="javascript:;" class="btEdit">Edit</a></td>
<td>Joana</td>
<td>28</td>
<td>Campinas</td>
</tr>
</tbody>
</table>
</div>
<br/>
<br/>
<footer>
sessistemas.com.br 2021 - <a href="mailto:samuelsantosdev@gmail.com">samuelsantosdev@gmail.com</a>
<br/>
<a href="https://github.com/samuelsantosdev/TableEdit" target="_blank">https://github.com/samuelsantosdev/TableEdit</a>
<br/>
Deus é fiel.
</footer>
</body>
</html>