Fixed emoji sorting in organization list and service list views.

This commit is contained in:
Christian P. MOMON 2022-01-21 19:41:41 +01:00
parent ebff7251e8
commit a1b0c34645
2 changed files with 78 additions and 14 deletions

View file

@ -47,15 +47,48 @@
<script type="text/javascript">
$(document).ready(function()
{
$.fn.dataTable.moment( 'DD/MM/YYYY' );
$.fn.dataTable.moment('DD/MM/YYYY');
$.extend($.fn.dataTable.ext.type.order,
{
"custom-sort-asc": function(x, y)
{
if (!(!isNaN(x) || !isNaN(y)))
return 0;
else if (isNaN(x))
return -1;
else if (isNaN(y))
return +1;
else
return x-y;
},
"custom-sort-desc": function(x, y)
{
if (!(!isNaN(x) || !isNaN(y)))
return 0;
else if (isNaN(x))
return +1;
else if (isNaN(y))
return -1;
else
return y-x;
}
} );
$('#organizations').DataTable(
{
paging: false,
ordering: true,
"order": [[ 2, "desc" ]],
language: dataTableFrench
});
{
paging: false,
ordering: true,
"order": [[ 2, "desc" ]],
language: dataTableFrench,
"columnDefs":
[
{ targets: 2, "type": 'custom-sort' },
{ targets: 3, "type": 'custom-sort' },
{ targets: 4, "type": 'custom-sort' }
]
});
} );
</script>
</body>

View file

@ -136,15 +136,46 @@
<script type="text/javascript">
$(document).ready(function()
{
$.fn.dataTable.moment( 'DD/MM/YYYY' );
$.fn.dataTable.moment('DD/MM/YYYY');
$.extend($.fn.dataTable.ext.type.order,
{
"custom-sort-asc": function(x, y)
{
if (!(!isNaN(x) || !isNaN(y)))
return 0;
else if (isNaN(x))
return -1;
else if (isNaN(y))
return +1;
else
return x-y;
},
"custom-sort-desc": function(x, y)
{
if (!(!isNaN(x) || !isNaN(y)))
return 0;
else if (isNaN(x))
return +1;
else if (isNaN(y))
return -1;
else
return y-x;
}
} );
$('#serviceListTable').DataTable(
{
paging: false,
ordering: true,
"order": [[ 2, "desc" ]],
language: dataTableFrench
});
{
paging: false,
ordering: true,
"order": [[ 2, "desc" ]],
language: dataTableFrench,
"columnDefs":
[
{ targets: 4, "type": 'custom-sort' },
{ targets: 5, "type": 'custom-sort' }
]
});
});
</script>
</body>