1
I have the code below that I am using to sort an array, in field with the format String is working normally, as I must to sort numeric field?
list_cob_frequencia() {
var campo = 'nome_campo';
var ordem = 'ASC';
return this.json_cobertura_frequencia.slice().sort(function(a, b) {
if (ordem == 'ASC') {
return (a[campo] < b[campo]) ? 1 : -1;
} else {
return (b[campo] < a[campo]) ? 1 : -1;
}
});
}
Has there been any response ?
– novic