N°2737 - Migrate table to DataTables plugin in display objects

This commit is contained in:
acognet
2021-03-30 08:53:22 +02:00
parent 7d92ff65a2
commit 6f9b5b7c64
8 changed files with 54 additions and 63 deletions

View File

@@ -11,10 +11,15 @@ var table{{ oUIBlock.GetId()|sanitize(constant('utils::ENUM_SANITIZATION_FILTER_
dom: "t",
"order": [],
{% if oUIBlock.GetOption("select_mode") is not empty %}
{% if oUIBlock.GetOption("select_mode") !="custom" %}
select: {
style: "{{ oUIBlock.GetOption("select_mode") }}"
},
{% endif %}
columnDefs: [
{orderable: false, targets: 0}
],
{% endif %}
});
if ($('#{{ oUIBlock.GetId() }}').find('thead').is(':visible'))
{

View File

@@ -35,18 +35,22 @@ $('#{{ oUIBlock.GetId() }}').DataTable({
rowId: "id",
filter: false,
{% if oUIBlock.GetOption("pageLength") is not empty %}
pageLength: {{ oUIBlock.GetOptions()["pageLength"] }},
pageLength: {{ oUIBlock.GetOption("pageLength") }},
{% endif %}
{% if oUIBlock.GetData()|length <= iPageSize %}
paging: false,
{% endif %}
{% if oUIBlock.GetOption("dom") is not empty %}
dom: "<'ibo-datatable-toolbar'{{ oUIBlock.GetOption("dom") }}>t",
{% else %}
dom: "<'ibo-datatable--toolbar'<'ibo-datatable--toolbar-left' pl><'ibo-datatable--toolbar-right' i>>t<'ibo-datatable--toolbar'<'ibo-datatable--toolbar-left' pl><'ibo-datatable--toolbar-right' i>>",
{% endif %}
lengthMenu: [[ {{ iPageSize }}, {{ iPageSize*2 }}, {{ iPageSize*3 }}, {{ iPageSize*4 }}, -1], [ {{ iPageSize }}, {{ iPageSize*2 }}, {{ iPageSize*3 }}, {{ iPageSize*4 }}, "{{ 'UI:Datatables:Language:DisplayLength:All'|dict_s }}"]],
columns: [
{% for key, column in oUIBlock.GetColumns() %}
{
data: "{{ key }}",
width: "auto",
width: "auto",
sortable: true
},
{% endfor %}