Closed BrunoVernay closed 3 years ago
Yes, you can define custom search and its sorting. See Integrations
section in Readme
@BrunoVernay right now as a quick workaround I'd suggest you creating a copy of the field and make toLowerCase()
on it and then sort on that new field.
Thanks. I ended up adding a static sort. My use case does not require to change it. So it is OK and simple.
But I did read the doc and links you gave, I tried some stuff, but did not understand how to do it. I still think an example would be nice.
Here what I have done for the static sort (near the end of search.js
):
...
result.data.items.sort( function(a, b) {
var nameA = a.name.toUpperCase();
var nameB = b.name.toUpperCase();
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
return 0;
})
return result
}
}
});
It works for me.
Is there an option to set so that sorting is case-insensitive? Or is there a way to define custom search where one could implement case-insensitive sort? Thanks