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 | 2aa223c0cac8c445e9f3855db66524cfdeae9380 (patch) | |
| tree | 8b9137dd9b68121db86e4e22dfdb7b7016a6f1ad /ishtar_common/templates/blocks/DataTables.html | |
| parent | 23697dd97eb201dd557272293227ec42a1c95a54 (diff) | |
| parent | daeeeb175835559724c8520f4f5a8dcd5957a469 (diff) | |
| download | Ishtar-2aa223c0cac8c445e9f3855db66524cfdeae9380.tar.bz2 Ishtar-2aa223c0cac8c445e9f3855db66524cfdeae9380.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}}"); |
