CXM_jquery_datatable.anubis
4.05 KB
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
/*
* Created by PyramIDE.
* User: Jeremy
* Date: 12/09/2012
* Time: 16:14
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
read calexium_lib/web/CXM_making_a_web_site.anubis
read calexium_lib/web/CXM_jquery.anubis
read calexium_lib/web/jQuery/CXM_jquery_datatable_types.anubis
read calexium_lib/web/jQuery/CXM_jquery_datatable_translation.anubis
read tools/basis.anubis
read system/string.anubis
read system/convert.anubis
/* Initialize jQuery datatables */
public define List(HTML_Head_Tag)
jquery_datatables_init
(
String web_dir,
)
=
[
css(css_file("/css/jquery/jquery.dataTables.css")),
css(css_file("/css/jquery/jquery.dataTables_themeroller.css")),
js(js_file("/js/jquery/jquery.dataTables.min.js"))
]
.
public define HTML_Partial_Content
jquery_datatable
(
String table_id,
HTML_Off_Form table
)
=
partial_content(
[ js_inline(script("", "$(document).ready(function(){$('#"+table_id+"').dataTable();});")) ],
table
)
.
public define HTML_Partial_Content
jquery_datatable
(
String table_id,
HTML_Off_Form table,
Bool enable_jqueryui,
)
=
if enable_jqueryui then
partial_content(
[ js_inline(script("", "$(document).ready(function(){$('#"+table_id+"').dataTable({\"bJQueryUI\":true});});")) ],
table
)
else
jquery_datatable(table_id, table)
.
public define HTML_Partial_Content
jquery_datatable
(
String table_id,
HTML_Off_Form table,
Bool enable_jqueryui,
Bool enable_pagination,
JQuery_datatable_pagination_type pagination_type,
JQuery_datatable_scrollY_type scrollY,
Bool enable_change_page_length, // if true, "enable_pagination" must be true too.
Bool enable_search_field,
Bool enable_columns_sorting,
String lang
)
=
partial_content(
[
js_inline(
script(
"",
"
$(document).ready(function()
{
$('#"+table_id+"').dataTable(
{
\"bJQueryUI\":"+to_String(enable_jqueryui)+",
\"sPaginationType\":'"+jquery_datatable_pagination_type_to_string(pagination_type)+"',
\"bFilter\":"+to_String(enable_search_field)+",
\"bPaginate\":"+to_String(enable_pagination)+","+
if scrollY is
{
no_scroll then "",
scrollY(size) then "\"sScrollY\": \""+size+"px\","
}+
"\"bStateSave\": true,
\"bLengthChange\":"+to_String(enable_change_page_length)+",
\"bSort\":"+to_String(enable_columns_sorting)+","+
get_datatable_translation(lang)+"
});
});
"
)
)
],
table
)
.
public define HTML_Partial_Content
jquery_datatable
(
String table_id,
HTML_Off_Form table,
Bool enable_jqueryui,
Bool enable_pagination,
JQuery_datatable_pagination_type pagination_type,
JQuery_datatable_scrollY_type scrollY,
Bool enable_change_page_length, // if true, "enable_pagination" must be true too.
Bool enable_search_field,
Bool enable_columns_sorting
) =
jquery_datatable(table_id, table, enable_jqueryui, enable_pagination, pagination_type, scrollY, enable_change_page_length, enable_search_field, enable_columns_sorting, "en").