Commit 8c8f29d3275b315a56c9b73e66bbe98a3248dc51

Authored by totoro
1 parent d35211aa

clean up the datatable and scroller extension

Showing 1 changed file with 134 additions and 134 deletions   Show diff stats
web/jQuery/CXM_jquery_datatable.anubis
1   -/*
2   - * Created by PyramIDE.
3   - * User: Jeremy
4   - * Date: 12/09/2012
5   - * Time: 16:14
6   - *
7   - * To change this template use Tools | Options | Coding | Edit Standard Headers.
8   - */
9   -
10   -read calexium_lib/web/CXM_making_a_web_site.anubis
11   -read calexium_lib/web/CXM_jquery.anubis
12   -read calexium_lib/web/jQuery/CXM_jquery_datatable_types.anubis
13   -read calexium_lib/web/jQuery/CXM_jquery_datatable_translation.anubis
14   -read tools/basis.anubis
15   -read system/string.anubis
16   -read system/convert.anubis
17   -
18   -/* Initialize jQuery datatables */
19   -public define List(HTML_Head_Tag)
20   - jquery_datatables_init
21   - (
22   - String web_dir,
23   - )
24   - =
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")),
29   - js(js_file("js/jquery/dataTables/dataTables.jqueryui.js")) ,
30   - css(css_file("js/jquery/dataTables/extensions/Scroller/css/shCore.css")),
31   - css(css_file("js/jquery/dataTables/extensions/Scroller/css/shThemeDataTables.css")),
32   - //css(css_file("js/jquery/dataTables/extensions/Scroller/css/doc.css")),
33   - css(css_file("js/jquery/dataTables/extensions/Scroller/css/dataTables.scroller.css")),
34   - js(js_file("js/jquery/dataTables/extensions/Scroller/js/dataTables.scroller.min.js")),
35   - ]
36   - .
37   -
38   -public define HTML_Partial_Content
39   - jquery_datatable
40   - (
41   - String table_id,
42   - HTML_Off_Form table
43   - )
44   - =
45   - partial_content(
46   - [ js_inline(script("", "$(document).ready(function(){$('#"+table_id+"').dataTable();});")) ],
47   - table
48   - )
49   - .
50   -
51   -public define HTML_Partial_Content
52   - jquery_datatable
53   - (
54   - String table_id,
55   - HTML_Off_Form table,
56   - Bool enable_jqueryui,
57   - )
58   - =
59   - if enable_jqueryui then
60   - partial_content(
61   - [ js_inline(script("", "$(document).ready(function(){$('#"+table_id+"').dataTable({\"bJQueryUI\":true});});")) ],
62   - table
63   - )
64   - else
65   - jquery_datatable(table_id, table)
66   - .
67   -
68   -
69   -public define HTML_Partial_Content
70   - jquery_datatable
71   - (
72   - String table_id,
73   - HTML_Off_Form table,
74   - Bool enable_jqueryui,
75   - Bool enable_pagination,
76   - JQuery_datatable_pagination_type pagination_type,
77   - JQuery_datatable_scrollY_type scrollY,
78   - Bool enable_change_page_length, // if true, "enable_pagination" must be true too.
79   - Bool enable_search_field,
80   - Bool enable_columns_sorting,
81   - String lang,
82   - JQuery_datatable_extra_type extra,
83   - String web_dir
84   - )
85   - =
86   - partial_content(
87   - [
88   - js_inline(
89   - script(
90   - "",
91   - "
92   - $(document).ready(function()
93   - {
94   - $('#"+table_id+"').dataTable(
95   - {
96   - \"bJQueryUI\":"+to_String(enable_jqueryui)+",
97   - \"sPaginationType\":'"+jquery_datatable_pagination_type_to_string(pagination_type)+"',
98   - \"bFilter\":"+to_String(enable_search_field)+",
99   - \"bPaginate\":"+to_String(enable_pagination)+","+
100   - if scrollY is
101   - {
102   - no_scroll then "",
103   - scrollY(size) then "\"sScrollY\": \""+size+"px\","
104   - }+
105   - "\"bStateSave\": true,
106   - \"bLengthChange\":"+to_String(enable_change_page_length)+",
107   - \"bSort\":"+to_String(enable_columns_sorting)+","+
108   - get_datatable_translation(lang, web_dir)+
109   - jquery_datatable_extra_to_string(extra)+
110   - "});
111   - });
112   - "
113   - )
114   - )
115   - ],
116   - table
117   - )
118   - .
119   -
120   -public define HTML_Partial_Content
121   - jquery_datatable
122   - (
123   - String table_id,
124   - HTML_Off_Form table,
125   - Bool enable_jqueryui,
126   - Bool enable_pagination,
127   - JQuery_datatable_pagination_type pagination_type,
128   - JQuery_datatable_scrollY_type scrollY,
129   - Bool enable_change_page_length, // if true, "enable_pagination" must be true too.
130   - Bool enable_search_field,
131   - Bool enable_columns_sorting,
132   - String web_dir
133   - ) =
134   - 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).
  1 +/*
  2 + * Created by PyramIDE.
  3 + * User: Jeremy
  4 + * Date: 12/09/2012
  5 + * Time: 16:14
  6 + *
  7 + * To change this template use Tools | Options | Coding | Edit Standard Headers.
  8 + */
  9 +
  10 +read calexium_lib/web/CXM_making_a_web_site.anubis
  11 +read calexium_lib/web/CXM_jquery.anubis
  12 +read calexium_lib/web/jQuery/CXM_jquery_datatable_types.anubis
  13 +read calexium_lib/web/jQuery/CXM_jquery_datatable_translation.anubis
  14 +read tools/basis.anubis
  15 +read system/string.anubis
  16 +read system/convert.anubis
  17 +
  18 +/* Initialize jQuery datatables */
  19 +public define List(HTML_Head_Tag)
  20 + jquery_datatables_init
  21 + (
  22 + String web_dir,
  23 + )
  24 + =
  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.js")),
  29 + //js(js_file("js/jquery/dataTables/dataTables.jqueryui.js")) , only for datatable 1.10
  30 + //css(css_file("js/jquery/dataTables/extensions/Scroller/css/shCore.css")),
  31 + //css(css_file("js/jquery/dataTables/extensions/Scroller/css/shThemeDataTables.css")),
  32 + //css(css_file("js/jquery/dataTables/extensions/Scroller/css/doc.css")),
  33 + css(css_file("js/jquery/dataTables/extensions/Scroller/css/dataTables.scroller.css")),
  34 + js(js_file("js/jquery/dataTables/extensions/Scroller/js/dataTables.scroller.js")),
  35 + ]
  36 + .
  37 +
  38 +public define HTML_Partial_Content
  39 + jquery_datatable
  40 + (
  41 + String table_id,
  42 + HTML_Off_Form table
  43 + )
  44 + =
  45 + partial_content(
  46 + [ js_inline(script("", "$(document).ready(function(){$('#"+table_id+"').dataTable();});")) ],
  47 + table
  48 + )
  49 + .
  50 +
  51 +public define HTML_Partial_Content
  52 + jquery_datatable
  53 + (
  54 + String table_id,
  55 + HTML_Off_Form table,
  56 + Bool enable_jqueryui,
  57 + )
  58 + =
  59 + if enable_jqueryui then
  60 + partial_content(
  61 + [ js_inline(script("", "$(document).ready(function(){$('#"+table_id+"').dataTable({\"bJQueryUI\":true});});")) ],
  62 + table
  63 + )
  64 + else
  65 + jquery_datatable(table_id, table)
  66 + .
  67 +
  68 +
  69 +public define HTML_Partial_Content
  70 + jquery_datatable
  71 + (
  72 + String table_id,
  73 + HTML_Off_Form table,
  74 + Bool enable_jqueryui,
  75 + Bool enable_pagination,
  76 + JQuery_datatable_pagination_type pagination_type,
  77 + JQuery_datatable_scrollY_type scrollY,
  78 + Bool enable_change_page_length, // if true, "enable_pagination" must be true too.
  79 + Bool enable_search_field,
  80 + Bool enable_columns_sorting,
  81 + String lang,
  82 + JQuery_datatable_extra_type extra,
  83 + String web_dir
  84 + )
  85 + =
  86 + partial_content(
  87 + [
  88 + js_inline(
  89 + script(
  90 + "",
  91 + "
  92 + $(document).ready(function()
  93 + {
  94 + $('#"+table_id+"').dataTable(
  95 + {
  96 + \"bJQueryUI\":"+to_String(enable_jqueryui)+",
  97 + \"sPaginationType\":'"+jquery_datatable_pagination_type_to_string(pagination_type)+"',
  98 + \"bFilter\":"+to_String(enable_search_field)+",
  99 + \"bPaginate\":"+to_String(enable_pagination)+","+
  100 + if scrollY is
  101 + {
  102 + no_scroll then "",
  103 + scrollY(size) then "\"sScrollY\": \""+size+"px\","
  104 + }+
  105 + "\"bStateSave\": true,
  106 + \"bLengthChange\":"+to_String(enable_change_page_length)+",
  107 + \"bSort\":"+to_String(enable_columns_sorting)+","+
  108 + get_datatable_translation(lang, web_dir)+
  109 + jquery_datatable_extra_to_string(extra)+
  110 + "});
  111 + });
  112 + "
  113 + )
  114 + )
  115 + ],
  116 + table
  117 + )
  118 + .
  119 +
  120 +public define HTML_Partial_Content
  121 + jquery_datatable
  122 + (
  123 + String table_id,
  124 + HTML_Off_Form table,
  125 + Bool enable_jqueryui,
  126 + Bool enable_pagination,
  127 + JQuery_datatable_pagination_type pagination_type,
  128 + JQuery_datatable_scrollY_type scrollY,
  129 + Bool enable_change_page_length, // if true, "enable_pagination" must be true too.
  130 + Bool enable_search_field,
  131 + Bool enable_columns_sorting,
  132 + String web_dir
  133 + ) =
  134 + 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).
... ...