diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-01-11 16:19:59 +0100 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-01-11 16:19:59 +0100 |
| commit | 1e05946531d237dc954f46ddfc25a6b61c084a74 (patch) | |
| tree | 8b9137dd9b68121db86e4e22dfdb7b7016a6f1ad /ishtar_common/templates/blocks/DataTables.html | |
| parent | 4779acd3006e6d6b17babd13585a4d83fb8d2332 (diff) | |
| parent | 9eced41d76545bd2921605b7b81bd14b875ce541 (diff) | |
| download | Ishtar-1e05946531d237dc954f46ddfc25a6b61c084a74.tar.bz2 Ishtar-1e05946531d237dc954f46ddfc25a6b61c084a74.zip | |
Merge branch 'develop'
Diffstat (limited to 'ishtar_common/templates/blocks/DataTables.html')
| -rw-r--r-- | ishtar_common/templates/blocks/DataTables.html | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/ishtar_common/templates/blocks/DataTables.html b/ishtar_common/templates/blocks/DataTables.html index b5f669963..096650115 100644 --- a/ishtar_common/templates/blocks/DataTables.html +++ b/ishtar_common/templates/blocks/DataTables.html @@ -152,7 +152,7 @@ jQuery(document).ready(function(){ } }, "select": { - "style": {% if multiple_select %}'multi'{% else %}'single'{% endif %} + "style": {% if multiple_select or quick_actions %}'multi'{% else %}'single'{% endif %} }, {% if multiple_select or quick_actions %}"buttons": [ {% for url, title, icon, target in quick_actions %} @@ -170,7 +170,7 @@ jQuery(document).ready(function(){ } }, {% if not forloop.last %},{% endif %} - {% endfor %}{% if multiple_select %}{% if quick_actions%},{% endif %} + {% endfor %}{% if quick_actions%},{% endif %} { extend: 'selectAll', text: '<i class="fa fa-check-circle-o"></i>', @@ -181,7 +181,6 @@ jQuery(document).ready(function(){ text: '<i class="fa fa-times"></i>', titleAttr: "{% trans 'Deselect' %}" } - {% endif %} ], "dom": 'lBtip', {% else %} @@ -192,7 +191,12 @@ jQuery(document).ready(function(){ { "data": "link", "orderable": false },{% for col in extra_cols %} { "data": "{{col}}", "defaultContent": "-", "render": $.fn.dataTable.render.ellipsis( 70, true ) }{% if not forloop.last %},{% endif %}{% endfor %} - ] + ], + "initComplete": function(settings, json) { + var api = new $.fn.dataTable.Api(settings); + {% if not multiple_select %}dt_single_enable_disable_submit_button(null, api); + {% else %}dt_multi_enable_disable_submit_button(null, api);{% endif %} + } }; if (!debug) $.fn.dataTable.ext.errMode = 'none'; @@ -201,6 +205,14 @@ jQuery(document).ready(function(){ if (datatables_i18n) datatable_options['language'] = datatables_i18n; datatable_{{sname}} = jQuery("#grid_{{name}}").DataTable(datatable_options); + {% if not multiple_select %} + datatable_{{sname}}.on('select', dt_single_enable_disable_submit_button); + datatable_{{sname}}.on('deselect', dt_single_enable_disable_submit_button); + {% else %} + datatable_{{sname}}.on('select', dt_multi_enable_disable_submit_button); + datatable_{{sname}}.on('deselect', dt_multi_enable_disable_submit_button); + {% endif %} + {% if multiple %} jQuery("#add_button_{{name}}").click(function (){ var mygrid = jQuery("#grid_{{name}}"); |
