Commit 45ec8a11aecefb06fe3d8d2d925552868936ee93
1 parent
3800362c
Add support of extra parameter in jQuery datatable
Add support of server side in jQuery datatable
Showing
3 changed files
with
61 additions
and
4 deletions
Show diff stats
web/jQuery/CXM_jquery_datatable.anubis
| @@ -73,7 +73,8 @@ public define HTML_Partial_Content | @@ -73,7 +73,8 @@ public define HTML_Partial_Content | ||
| 73 | Bool enable_change_page_length, // if true, "enable_pagination" must be true too. | 73 | Bool enable_change_page_length, // if true, "enable_pagination" must be true too. |
| 74 | Bool enable_search_field, | 74 | Bool enable_search_field, |
| 75 | Bool enable_columns_sorting, | 75 | Bool enable_columns_sorting, |
| 76 | - String lang | 76 | + String lang, |
| 77 | + JQuery_datatable_extra_type extra | ||
| 77 | ) | 78 | ) |
| 78 | = | 79 | = |
| 79 | partial_content( | 80 | partial_content( |
| @@ -98,8 +99,9 @@ public define HTML_Partial_Content | @@ -98,8 +99,9 @@ public define HTML_Partial_Content | ||
| 98 | "\"bStateSave\": true, | 99 | "\"bStateSave\": true, |
| 99 | \"bLengthChange\":"+to_String(enable_change_page_length)+", | 100 | \"bLengthChange\":"+to_String(enable_change_page_length)+", |
| 100 | \"bSort\":"+to_String(enable_columns_sorting)+","+ | 101 | \"bSort\":"+to_String(enable_columns_sorting)+","+ |
| 101 | - get_datatable_translation(lang)+" | ||
| 102 | - }); | 102 | + get_datatable_translation(lang)+ |
| 103 | + jquery_datatable_extra_to_string(extra)+ | ||
| 104 | + "}); | ||
| 103 | }); | 105 | }); |
| 104 | " | 106 | " |
| 105 | ) | 107 | ) |
| @@ -122,4 +124,4 @@ public define HTML_Partial_Content | @@ -122,4 +124,4 @@ public define HTML_Partial_Content | ||
| 122 | Bool enable_search_field, | 124 | Bool enable_search_field, |
| 123 | Bool enable_columns_sorting | 125 | Bool enable_columns_sorting |
| 124 | ) = | 126 | ) = |
| 125 | - jquery_datatable(table_id, table, enable_jqueryui, enable_pagination, pagination_type, scrollY, enable_change_page_length, enable_search_field, enable_columns_sorting, "en"). | 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). |
| 1 | +/* | ||
| 2 | + * Created by PyramIDE. | ||
| 3 | + * User: Totoro | ||
| 4 | + * Date: 03/05/2014 | ||
| 5 | + * Time: 17:46 | ||
| 6 | + * | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | +read calexium_lib/web/jQuery/CXM_jquery_datatable_types.anubis | ||
| 10 | +read tools/basis.anubis | ||
| 11 | +read calexium_lib/web/CXM_common.anubis | ||
| 12 | +read calexium_lib/web/CXM_web_arg_utils.anubis | ||
| 13 | + | ||
| 14 | +public define Maybe(JQuery_datatable_server_side_type) | ||
| 15 | + get_datatable_server_side_query | ||
| 16 | + ( | ||
| 17 | + List(Web_arg) lwa | ||
| 18 | + )= | ||
| 19 | + | ||
| 20 | + if get_String(lwa, "sEcho") is {failure then failure, success(secho) then | ||
| 21 | + if get_Int(lwa, "iColumns") is {failure then failure, success(icolumns) then | ||
| 22 | + if get_String(lwa, "sColumns") is {failure then failure, success(scolumns) then | ||
| 23 | + if get_Int(lwa, "iDisplayStart") is {failure then failure, success(idisplaystart) then | ||
| 24 | + if get_Int(lwa, "iDisplayLength") is {failure then failure, success(idisplaylength) then | ||
| 25 | + if get_String(lwa, "sSearch") is {failure then failure, success(sSearch) then | ||
| 26 | +// if get_String(lwa, "sSortDir") is {failure then failure, success(sSortDir) then | ||
| 27 | + success(dt_ss(secho, icolumns, scolumns, idisplaystart, idisplaylength, sSearch)) | ||
| 28 | + }}}}}}. | ||
| 29 | + |
web/jQuery/CXM_jquery_datatable_types.anubis
| @@ -11,6 +11,7 @@ read calexium_lib/web/CXM_making_a_web_site.anubis | @@ -11,6 +11,7 @@ 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 | public type JQuery_datatable_pagination_type: | 15 | public type JQuery_datatable_pagination_type: |
| 15 | jq_dt_pt_two_button, //default option | 16 | jq_dt_pt_two_button, //default option |
| 16 | jq_dt_pt_full_numbers | 17 | jq_dt_pt_full_numbers |
| @@ -19,6 +20,21 @@ public type JQuery_datatable_scrollY_type: | @@ -19,6 +20,21 @@ public type JQuery_datatable_scrollY_type: | ||
| 19 | no_scroll, | 20 | no_scroll, |
| 20 | scrollY(Int size). | 21 | scrollY(Int size). |
| 21 | 22 | ||
| 23 | +public type JQuery_datatable_extra_type: | ||
| 24 | + no_extra, | ||
| 25 | + extra(String extra). | ||
| 26 | + | ||
| 27 | +public define String | ||
| 28 | + jquery_datatable_extra_to_string | ||
| 29 | + ( | ||
| 30 | + JQuery_datatable_extra_type ex | ||
| 31 | + )= | ||
| 32 | + if ex is | ||
| 33 | + { | ||
| 34 | + no_extra then "", | ||
| 35 | + extra(_ex) then ",\n"+_ex | ||
| 36 | + }. | ||
| 37 | + | ||
| 22 | public define String | 38 | public define String |
| 23 | jquery_datatable_pagination_type_to_string | 39 | jquery_datatable_pagination_type_to_string |
| 24 | ( | 40 | ( |
| @@ -43,3 +59,13 @@ public define JQuery_datatable_pagination_type | @@ -43,3 +59,13 @@ public define JQuery_datatable_pagination_type | ||
| 43 | if st="full_numbers" then jq_dt_pt_full_numbers else | 59 | if st="full_numbers" then jq_dt_pt_full_numbers else |
| 44 | jq_dt_pt_two_button | 60 | jq_dt_pt_two_button |
| 45 | . | 61 | . |
| 62 | + | ||
| 63 | +public type JQuery_datatable_server_side_type: | ||
| 64 | + dt_ss( String sEcho, | ||
| 65 | + Int iColumns, | ||
| 66 | + String sColumns, | ||
| 67 | + Int iDisplayStart, | ||
| 68 | + Int iDisplayLength, | ||
| 69 | + String sSearch | ||
| 70 | + ). | ||
| 71 | + |