diff options
Diffstat (limited to 'ishtar_common/templates/blocks/DataTables.html')
-rw-r--r-- | ishtar_common/templates/blocks/DataTables.html | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/ishtar_common/templates/blocks/DataTables.html b/ishtar_common/templates/blocks/DataTables.html index b5f669963..e1966787b 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,11 @@ 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); + dt_single_enable_disable_submit_button(null, api); + } }; if (!debug) $.fn.dataTable.ext.errMode = 'none'; @@ -201,6 +204,11 @@ 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); + {% endif %} + {% if multiple %} jQuery("#add_button_{{name}}").click(function (){ var mygrid = jQuery("#grid_{{name}}"); |