Commit 9b0c86d04114d4d605e88daab5839c83a4f231c3

Authored by totoro
1 parent 7235a8fc

bump datatable to 1.10

add support of scroller extension of datatable
datatable translation file is now dynamically tested instead of constant
web/jQuery/CXM_jquery_datatable.anubis
@@ -23,9 +23,12 @@ public define List(HTML_Head_Tag) @@ -23,9 +23,12 @@ public define List(HTML_Head_Tag)
23 ) 23 )
24 = 24 =
25 [ 25 [
26 - css(css_file("/css/jquery/jquery.dataTables.css")),  
27 - css(css_file("/css/jquery/jquery.dataTables_themeroller.css")),  
28 - js(js_file("/js/jquery/jquery.dataTables.min.js")) 26 + css(css_file("/css/jquery/jquery.dataTables.min.css")),
  27 + css(css_file("/css/jquery/jquery.dataTables_themeroller.min.css")),
  28 + js(js_file("/js/jquery/jquery.dataTables.min.js")),
  29 + css(css_file("js/jquery/dataTables/extensions/Scroller/css/dataTables.scroller.min.css")),
  30 + js(js_file("js/jquery/dataTables/extensions/Scroller/js/dataTables.scroller.min.js")),
  31 +
29 ] 32 ]
30 . 33 .
31 34
@@ -74,7 +77,8 @@ public define HTML_Partial_Content @@ -74,7 +77,8 @@ public define HTML_Partial_Content
74 Bool enable_search_field, 77 Bool enable_search_field,
75 Bool enable_columns_sorting, 78 Bool enable_columns_sorting,
76 String lang, 79 String lang,
77 - JQuery_datatable_extra_type extra 80 + JQuery_datatable_extra_type extra,
  81 + String web_dir
78 ) 82 )
79 = 83 =
80 partial_content( 84 partial_content(
@@ -99,7 +103,7 @@ public define HTML_Partial_Content @@ -99,7 +103,7 @@ public define HTML_Partial_Content
99 "\"bStateSave\": true, 103 "\"bStateSave\": true,
100 \"bLengthChange\":"+to_String(enable_change_page_length)+", 104 \"bLengthChange\":"+to_String(enable_change_page_length)+",
101 \"bSort\":"+to_String(enable_columns_sorting)+","+ 105 \"bSort\":"+to_String(enable_columns_sorting)+","+
102 - get_datatable_translation(lang)+ 106 + get_datatable_translation(lang, web_dir)+
103 jquery_datatable_extra_to_string(extra)+ 107 jquery_datatable_extra_to_string(extra)+
104 "}); 108 "});
105 }); 109 });
@@ -122,6 +126,7 @@ public define HTML_Partial_Content @@ -122,6 +126,7 @@ public define HTML_Partial_Content
122 JQuery_datatable_scrollY_type scrollY, 126 JQuery_datatable_scrollY_type scrollY,
123 Bool enable_change_page_length, // if true, "enable_pagination" must be true too. 127 Bool enable_change_page_length, // if true, "enable_pagination" must be true too.
124 Bool enable_search_field, 128 Bool enable_search_field,
125 - Bool enable_columns_sorting 129 + Bool enable_columns_sorting,
  130 + String web_dir
126 ) = 131 ) =
127 - jquery_datatable(table_id, table, enable_jqueryui, enable_pagination, pagination_type, scrollY, enable_change_page_length, enable_search_field, enable_columns_sorting, "en", no_extra). 132 + jquery_datatable(table_id, table, enable_jqueryui, enable_pagination, pagination_type, scrollY, enable_change_page_length, enable_search_field, enable_columns_sorting, "en", no_extra, web_dir).
web/jQuery/CXM_jquery_datatable_translation.anubis
@@ -7,19 +7,23 @@ @@ -7,19 +7,23 @@
7 * To change this template use Tools | Options | Coding | Edit Standard Headers. 7 * To change this template use Tools | Options | Coding | Edit Standard Headers.
8 */ 8 */
9 9
  10 +read tools/basis.anubis
10 11
11 public define String 12 public define String
12 get_datatable_translation 13 get_datatable_translation
13 ( 14 (
14 - String language 15 + String language,
  16 + String web_dir
15 )= 17 )=
16 - with file = if language = "en" then "en" else  
17 - if language = "fr" then "fr" else  
18 - if language = "zh" then "zh" else  
19 - if language = "ja" then "ja" else  
20 - "en", 18 +
  19 + with file = if file_exists(web_dir+"/public/js/jquery/dataTables/translation/"+language+".txt") then
  20 + language
  21 + else
  22 + println("NOT FOUND : "+web_dir+"/public/js/jquery/dataTables/translation/"+language+".txt");
  23 + "en",
  24 +
21 "\"oLanguage\": { 25 "\"oLanguage\": {
22 - \"sUrl\": \"/js/jquery/dataTables/"+file+".txt\" 26 + \"sUrl\": \"/js/jquery/dataTables/translation/"+file+".txt\"
23 }". 27 }".
24 28
25 29
web/jQuery/CXM_jquery_datatable_types.anubis
@@ -11,10 +11,14 @@ read calexium_lib/web/CXM_making_a_web_site.anubis @@ -11,10 +11,14 @@ read calexium_lib/web/CXM_making_a_web_site.anubis
11 read tools/basis.anubis 11 read tools/basis.anubis
12 read system/string.anubis 12 read system/string.anubis
13 13
14 - 14 + pagingType Since: 1.10
  15 + Pagination button display options
  16 +
15 public type JQuery_datatable_pagination_type: 17 public type JQuery_datatable_pagination_type:
16 - jq_dt_pt_two_button, //default option  
17 - jq_dt_pt_full_numbers 18 + jq_dt_pt_simple, //'Previous' and 'Next' buttons only
  19 + jq_dt_pt_simple_numbers, //'Previous' and 'Next' buttons, plus page numbers (default option)
  20 + jq_dt_pt_full, //'First', 'Previous', 'Next' and 'Last' buttons
  21 + jq_dt_pt_full_numbers //'First', 'Previous', 'Next' and 'Last' buttons, plus page numbers
18 . 22 .
19 public type JQuery_datatable_scrollY_type: 23 public type JQuery_datatable_scrollY_type:
20 no_scroll, 24 no_scroll,
@@ -41,12 +45,13 @@ public define String @@ -41,12 +45,13 @@ public define String
41 JQuery_datatable_pagination_type pt 45 JQuery_datatable_pagination_type pt
42 ) 46 )
43 = 47 =
44 - if pt is  
45 - {  
46 - jq_dt_pt_two_button then "two_button",  
47 - jq_dt_pt_full_numbers then "full_numbers"  
48 - }  
49 - . 48 + if pt is
  49 + {
  50 + jq_dt_pt_simple then "simple",
  51 + jq_dt_pt_simple_numbers then "simple_numbers",
  52 + jq_dt_pt_full then "full",
  53 + jq_dt_pt_full_numbers then "full_numbers",
  54 + }.
50 55
51 public define JQuery_datatable_pagination_type 56 public define JQuery_datatable_pagination_type
52 string_to_jquery_datatable_pagination_type 57 string_to_jquery_datatable_pagination_type
@@ -55,9 +60,11 @@ public define JQuery_datatable_pagination_type @@ -55,9 +60,11 @@ public define JQuery_datatable_pagination_type
55 ) 60 )
56 = 61 =
57 with st=to_lower(str), 62 with st=to_lower(str),
58 - if st="two_button" then jq_dt_pt_two_button else  
59 - if st="full_numbers" then jq_dt_pt_full_numbers else  
60 - jq_dt_pt_two_button 63 + if st="simple" then jq_dt_pt_simple else
  64 + if st="simple_numbers" then jq_dt_pt_simple_numbers else
  65 + if st="full" then jq_dt_pt_full else
  66 + if st="full_numbers" then jq_dt_pt_full_numbers else
  67 + jq_dt_pt_simple_numbers
61 . 68 .
62 69
63 public type JQuery_datatable_server_side_type: 70 public type JQuery_datatable_server_side_type: