Fix materials table alphabetical sorting - materials now sort by name
Co-authored-by: naielv <109038805+naielv@users.noreply.github.com>
This commit is contained in:
@@ -719,6 +719,16 @@ function TS_IndexElement(
|
||||
|
||||
function render() {
|
||||
function sorter(a, b) {
|
||||
// If data has Nombre field (like materials), sort alphabetically by name
|
||||
if (a.Nombre && b.Nombre) {
|
||||
const nameA = a.Nombre.toLowerCase();
|
||||
const nameB = b.Nombre.toLowerCase();
|
||||
if (nameA < nameB) return -1;
|
||||
if (nameA > nameB) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Otherwise, sort by Fecha (date) for other data types
|
||||
if (a.Fecha < b.Fecha) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user