vue3-easy-data-table
vue3-easy-data-table copied to clipboard
Sorting not wirking properly when the column data are numbers
If the data of one column are numbers, the sorting does not work properly, as it treats the data as it were strings. See column "Precio de oferta" in the images
Here is my code for the headers:
const headers: Header[] = [
{ text: 'ID', value: 'id', sortable: true },
{ text: 'Fecha', value: 'attributes.createdAt', sortable: true },
{ text: 'Precio de Oferta', value: 'attributes.price', sortable: true },
{ text: 'Periodo de entrega', value: 'attributes.deliveryPeriod', sortable: true },
{ text: 'Condición de pago', value: 'attributes.paymentCondition', sortable: true },
{ text: 'Email', value: 'attributes.user.data.attributes.emailContact', sortable: true },
Is there a way to declare the data type of one column or to use a custom function for the sorting?
I do not have the mentioned issues when using numbers.
Make sure that the data realy contains items of the type Number and you format the number via an item-slot (e.g. to add the periods . as a localized form).
Hello Friends ! Excellent component! But the Client Sorting is not working correctly especially when the column has numbers
The same bug @lucasboh !
Thanks in advance !
Hello @jxn-30 the same problem on the project's official website! https://hc200ok.github.io/vue3-easy-data-table-doc/features/single-field-sorting.html
did anyone come up with a solution for this?
found my problem: the property and value you want to sort by has to exist in the item object, it cant be derived in the item template
@Samiam519
found my problem: the property and value you want to sort by has to exist in the item object, it cant be derived in the item template
can you explain please how to solved ? I'm very interested to this issue.