fix clients sorting

parent fc2f2240
......@@ -340,7 +340,7 @@ class BUIgrantHandler(BUImetaGrant, BUIacl):
return reversed(ret)
return ret
def _extract_advanced_mode(self, username, mode, kind, idx=None):
def _extract_advanced_mode(self, username, mode, kind, idx):
return self._extract_advanced(username, idx).get(mode, {}).get(kind, [])
def _client_match(self, username, client):
......
......@@ -124,19 +124,16 @@ var _clients_table = $('#table-clients').DataTable( {
}
},
{
data: null,
data: 'last',
type: 'timestamp',
render: function (data, type, row ) {
if (type === 'filter' || type === 'sort') {
if (!(data.last in __status || data.last in __date)) {
return data.last;
}
// sort by name when date is not valid
return data.name;
return data;
}
if (!(data in __status || data in __date)) {
return '<span data-toggle="tooltip" title="'+data+'">'+moment(data, moment.ISO_8601).format({{ g.date_format|tojson }})+'</span>';
}
if (!(data.last in __status || data.last in __date))
return '<span data-toggle="tooltip" title="'+data.last+'">'+moment(data.last, moment.ISO_8601).format({{ g.date_format|tojson }})+'</span>';
return data.last
return data;
}
},
{
......
......@@ -170,6 +170,9 @@ jQuery.extend( jQuery.fn.dataTableExt.oSort, {
if (moment(a, moment.ISO_8601).isValid())
return ''+moment(a, moment.ISO_8601).valueOf();
// return some string that should be "last"
if (a === '{{ _("now") }}') {
return 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'+a;
}
return 'zzzzzzzzzzzzzzzzzzzz'+a;
},
"timestamp-asc": function ( a, b ) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment