-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathapp.py
62 lines (56 loc) · 1.18 KB
/
app.py
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
from flask import Flask, render_template
import json
"""
A example for creating a Table that is sortable by its header
"""
app = Flask(__name__)
data = [{
"name": "bootstrap-table",
"commits": "10",
"attention": "122",
"uneven": "An extended Bootstrap table"
},
{
"name": "multiple-select",
"commits": "288",
"attention": "20",
"uneven": "A jQuery plugin"
}, {
"name": "Testing",
"commits": "340",
"attention": "20",
"uneven": "For test"
}]
# other column settings -> http://bootstrap-table.wenzhixin.net.cn/documentation/#column-options
columns = [
{
"field": "name", # which is the field's name of data key
"title": "name", # display as the table header's name
"sortable": True,
},
{
"field": "commits",
"title": "commits",
"sortable": True,
},
{
"field": "attention",
"title": "attention",
"sortable": True,
},
{
"field": "uneven",
"title": "uneven",
"sortable": True,
}
]
#jdata=json.dumps(data)
@app.route('/')
def index():
return render_template("table.html",
data=data,
columns=columns,
title='Flask Bootstrap Table')
if __name__ == '__main__':
#print jdata
app.run(debug=True)