Commit 09aeddee3814462e403090c571a5e23f991d70d8
1 parent
c288c58a
New:
- Add 2 functions with more customizations for jQuery datatables. - Add 1 type for handling some options fir jQuery datatables.
Showing
2 changed files
with
108 additions
and
0 deletions
Show diff stats
web/CXM_jquery_datatable.anubis
| @@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
| 9 | 9 | ||
| 10 | read calexium_lib/web/CXM_making_a_web_site.anubis | 10 | read calexium_lib/web/CXM_making_a_web_site.anubis |
| 11 | read calexium_lib/web/CXM_jquery.anubis | 11 | read calexium_lib/web/CXM_jquery.anubis |
| 12 | +read calexium_lib/web/CXM_jquery_datatable_types.anubis | ||
| 12 | read tools/basis.anubis | 13 | read tools/basis.anubis |
| 13 | read system/string.anubis | 14 | read system/string.anubis |
| 14 | 15 | ||
| @@ -39,3 +40,68 @@ public define HTML_Partial_Content | @@ -39,3 +40,68 @@ public define HTML_Partial_Content | ||
| 39 | table | 40 | table |
| 40 | ) | 41 | ) |
| 41 | . | 42 | . |
| 43 | + | ||
| 44 | +public define HTML_Partial_Content | ||
| 45 | + jquery_datatable | ||
| 46 | + ( | ||
| 47 | + String table_id, | ||
| 48 | + HTML_Off_Form table, | ||
| 49 | + Bool enable_jqueryui, | ||
| 50 | + ) | ||
| 51 | + = | ||
| 52 | + if enable_jqueryui then | ||
| 53 | + partial_content( | ||
| 54 | + [ js_inline(script("", "$(document).ready(function(){$('#"+table_id+"').dataTable({\"bJQueryUI\":true});});")) ], | ||
| 55 | + table | ||
| 56 | + ) | ||
| 57 | + else | ||
| 58 | + jquery_datatable(table_id, table) | ||
| 59 | + . | ||
| 60 | + | ||
| 61 | +public define String | ||
| 62 | + bool_to_string | ||
| 63 | + ( | ||
| 64 | + Bool b | ||
| 65 | + ) | ||
| 66 | + = | ||
| 67 | + if b then "true" else "false" | ||
| 68 | + . | ||
| 69 | + | ||
| 70 | +public define HTML_Partial_Content | ||
| 71 | + jquery_datatable | ||
| 72 | + ( | ||
| 73 | + String table_id, | ||
| 74 | + HTML_Off_Form table, | ||
| 75 | + Bool enable_jqueryui, | ||
| 76 | + Bool enable_pagination, | ||
| 77 | + JQuery_datatable_pagination_type pagination_type, | ||
| 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 | + ) | ||
| 82 | + = | ||
| 83 | + partial_content( | ||
| 84 | + [ | ||
| 85 | + js_inline( | ||
| 86 | + script( | ||
| 87 | + "", | ||
| 88 | + " | ||
| 89 | + $(document).ready(function() | ||
| 90 | + { | ||
| 91 | + $('#"+table_id+"').dataTable( | ||
| 92 | + { | ||
| 93 | + \"bJQueryUI\":"+bool_to_string(enable_jqueryui)+", | ||
| 94 | + \"sPaginationType\":'"+jquery_datatable_pagination_type_to_string(pagination_type)+"', | ||
| 95 | + \"bFilter\":"+bool_to_string(enable_search_field)+", | ||
| 96 | + \"bPaginate\":"+bool_to_string(enable_pagination)+", | ||
| 97 | + \"bLengthChange\":"+bool_to_string(enable_change_page_length)+", | ||
| 98 | + \"bSort\":"+bool_to_string(enable_columns_sorting)+" | ||
| 99 | + }); | ||
| 100 | + }); | ||
| 101 | + " | ||
| 102 | + ) | ||
| 103 | + ) | ||
| 104 | + ], | ||
| 105 | + table | ||
| 106 | + ) | ||
| 107 | + . |
| 1 | +/* | ||
| 2 | + * Created by PyramIDE. | ||
| 3 | + * User: Jeremy | ||
| 4 | + * Date: 13/09/2012 | ||
| 5 | + * Time: 10:12 | ||
| 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 tools/basis.anubis | ||
| 12 | +read system/string.anubis | ||
| 13 | + | ||
| 14 | +public type JQuery_datatable_pagination_type: | ||
| 15 | + jq_dt_pt_two_button, //default option | ||
| 16 | + jq_dt_pt_full_numbers | ||
| 17 | +. | ||
| 18 | + | ||
| 19 | +public define String | ||
| 20 | + jquery_datatable_pagination_type_to_string | ||
| 21 | + ( | ||
| 22 | + JQuery_datatable_pagination_type pt | ||
| 23 | + ) | ||
| 24 | + = | ||
| 25 | + if pt is | ||
| 26 | + { | ||
| 27 | + jq_dt_pt_two_button then "two_button", | ||
| 28 | + jq_dt_pt_full_numbers then "full_numbers" | ||
| 29 | + } | ||
| 30 | + . | ||
| 31 | + | ||
| 32 | +public define JQuery_datatable_pagination_type | ||
| 33 | + string_to_jquery_datatable_pagination_type | ||
| 34 | + ( | ||
| 35 | + String str | ||
| 36 | + ) | ||
| 37 | + = | ||
| 38 | + with st=to_lower(str), | ||
| 39 | + if st="two_button" then jq_dt_pt_two_button else | ||
| 40 | + if st="full_numbers" then jq_dt_pt_full_numbers else | ||
| 41 | + jq_dt_pt_two_button | ||
| 42 | + . |