-
Notifications
You must be signed in to change notification settings - Fork 1
/
tabla.html
211 lines (179 loc) · 8.43 KB
/
tabla.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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<!--
tabla.html
Copyright 2012 Informatica MEG <[email protected]>,
emiliano <[email protected]>,
david <[email protected]
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
-->
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
{% block title %}
<title>Tabla</title>
{% endblock %}
{% block css %}
<link rel="stylesheet" type="text/css" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<link rel="stylesheet" href="css/dinamictable.css" type="text/css" media="print, projection, screen" />
{% endblock %}
{% block js %}
<script type="text/javascript" charset="utf-8" language="javascript" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" language="javascript" src="js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8" language="javascript" src="js/dinamictable.js"></script>
{% endblock%}
</head>
<body>
{% block body %}
<div class="contenedor">
<div class="container">
{% block table %}
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example">
<thead>
<tr>
<td>Apellido</td>
<td>Nombre</td>
<td>Teléfono</td>
</tr>
</thead>
<tbody>
<tr>
<td>Perez</td>
<td>Pedro</td>
<td>01234567890</td>
</tr>
<tr>
<td>Rodriguez</td>
<td>Juan</td>
<td>01234567891</td>
</tr>
<tr>
<td>Garcia</td>
<td>Ariel</td>
<td>01234567892</td>
</tr>
<tr>
<td>Gonzalez</td>
<td>Benito</td>
<td>01234567893</td>
</tr>
<tr>
<td>Franco</td>
<td>Francisco</td>
<td>01234567894</td>
</tr>
</tbody>
</table>
{% endblock %}
</div>
</div>
{% endblock %}
</body>
<!--
This is an example by default, shows a table previously formatted by the programmer,
also works with another type of table generators, like jinja templates.
-->
<!--
<script type="text/javascript" charset="utf-8" language="javascript">
/* Table initialisation */
$(document).ready(function() {
showTableStatic();
} );
</script>
-->
<!--
This is an example for a table generated from an array of objects or a JSON.
Uncomment if you want to see how it works :)
-->
<!--
<script type="text/javascript" charset="utf-8" language="javascript">
/* Table initialisation */
$(document).ready(function() {
// Test Array of Objects Data
var objectsArray = [{"Last Name":"Smith","First Name":"John","Email":"[email protected]","Due":"<b> $350.00 </b>","Web Site":'http://www.jsmith.com'},
{"Last Name":"Mastropiero","First Name":"Johan Sebastian","Email":"[email protected]","Due":"$10.00","Web Site":"http://www.mastropiero.com"},
{"Last Name":"Perez","First Name":"Marcos","Email":"[email protected]","Due":"$810.00","Web Site":"http://www.perezmarcos.com"},
{"Last Name":"Sanchez","First Name":"Mariana","Email":"[email protected]","Due":"$200.00","Web Site":"http://www.marianis.com"},
{"Last Name":"Rodriguez","First Name":"Cassandra","Email":"[email protected]","Due":"$48.00","Web Site":"http://www.cassandrita.com"},
{"Last Name":"Cordera","First Name":"Pelado","Email":"[email protected]","Due":"$4.00","Web Site":"http://www.peladocordera.com"},
{"Last Name":"García","First Name":"Charly","Email":"[email protected]","Due":"$253.00","Web Site":"http://www.charlysnm.com"},
{"Last Name":"Hendrix","First Name":"Jimmy","Email":"[email protected]","Due":"$20.00","Web Site":"http://www.jimmyhendrix.com"},
{"Last Name":"Marley","First Name":"Bob","Email":"[email protected]","Due":"$10.00","Web Site":"http://www.bobmarley.com"},
{"Last Name":"Starr","First Name":"Ringo","Email":"[email protected]","Due":"$5.00","Web Site":"http://www.ringobeatle.com"},
{"Last Name":"Lennon","First Name":"John","Email":"[email protected]","Due":"$50.00","Web Site":"http://www.lennon.com"},
{"Last Name":"Bach","First Name":"George","Email":"[email protected]","Due":"$50.00","Web Site":"http://www.george.com"},
{"Last Name":"Doe","First Name":"Jason","Email":"[email protected]","Due":"$99.00","Web Site":"http://www.jdoe.com"},
{"Last Name":"Conway","First Name":"Tim","Email":"[email protected]","Due":"$50.00","Web Site":"http://www.timconway.com"}];
// This function creates the table
var data = createTableFromJSON(objectsArray);
/*
You can add an html tag to a specific column.
convertToLink returns a new dataArray with text of a specific column (e.g. "www.google.com")
converted into a link (e.g. "<a href='www.google.com' target='_blank'>www.google.com</a>).
convertToBold returns a new dataArray with text of a specific column with its text in bold.
convertToSomeTag returns a new dataArray with text of a specific column with its text whitin
a specific tag (e.g. if the tag is ["<i>","</i>] the text will be in italic.
*/
tableData = data[0];
convertToLink(tableData,4);
convertToBold(tableData,3);
convertToSomeTag(tableData,2,["<i>","</i>"])
convertToSomeTag(tableData,0,["<u>","</u>"])
// Shows the table
showTableDinamic(data);
} );
</script>
-->
<!--
This is an example for a table generated from an array of arrays.
Uncomment if you want to see how it works :)
-->
<script type="text/javascript" charset="utf-8" language="javascript">
/* Table initialisation */
$(document).ready(function() {
// Test Array of Arrays Data
var arraysArray = [["Last Name","First Name","Email","Due","Web Site","Is Alive?"],
["Smith","John","[email protected]","<b> $350.00 </b>",'http://www.jsmith.com',"No"],
["Mastropiero","Johan Sebastian","[email protected]","$10.00","http://www.mastropiero.com","No"],
["Perez","Marcos","[email protected]","$810.00","http://www.perezmarcos.com","Yes"],
["Sanchez","Mariana","[email protected]","$200.00","http://www.marianis.com","Yes"],
["Rodriguez","Cassandra","[email protected]","$48.00","http://www.cassandrita.com","Yes"],
["García","Charly","[email protected]","$253.00","http://www.charlysnm.com","Yes"],
["Hendrix","Jimmy","[email protected]","$20.00","http://www.jimmyhendrix.com","No"],
["Marley","Bob","[email protected]","$10.00","http://www.bobmarley.com","No"],
["Starr","Ringo","[email protected]","$5.00","http://www.ringobeatle.com","Yes"],
["Lennon","John","[email protected]","$50.00","http://www.lennon.com","No"],
["Bach","George","[email protected]","$50.00","http://www.george.com","No"],
["Doe","Jason","[email protected]","$99.00","http://www.jdoe.com","Yes"],
["Conway","Tim","[email protected]","$50.00","http://www.timconway.com","Yes"]];
// This function creates the table
var data = createTableFromArraysArray(arraysArray);
/*
You can add an html tag to a specific column.
convertToLink returns a new dataArray with text of a specific column (e.g. "www.google.com")
converted into a link (e.g. "<a href='www.google.com' target='_blank'>www.google.com</a>).
convertToBold returns a new dataArray with text of a specific column with its text in bold.
convertToSomeTag returns a new dataArray with text of a specific column with its text whitin
a specific tag (e.g. if the tag is ["<i>","</i>] the text will be in italic.
*/
tableData = data[0];
convertToLink(tableData,4);
convertToBold(tableData,3);
convertToSomeTag(tableData,2,["<i>","</i>"]);
convertToSomeTag(tableData,0,["<u>","</u>"]);
// You can also add some bootstrap
convertToSomeTag(tableData,5,["<a class='btn btn-success' href='#'>","</a>"]);
// Shows the table
showTableDinamic(data);
} );
</script>