Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting broken with mixed data types #744

Closed
1 task done
wolph opened this issue Aug 9, 2020 · 3 comments
Closed
1 task done

Sorting broken with mixed data types #744

wolph opened this issue Aug 9, 2020 · 3 comments

Comments

@wolph
Copy link

wolph commented Aug 9, 2020

Issue Type

  • Bug

Specs

What version are you using?
2.19.1

What browser?
Google Chrome

Expected Behavior

A working sort

Actual Behavior

Errors because the values are expected to be strings

Steps to Reproduce the Problem

Please detail your steps here

  1. Open the jsfiddle
  2. Click on the column to sort

jsfiddle

https://jsfiddle.net/fe5ast61/

@xaksis
Copy link
Owner

xaksis commented Aug 9, 2020

Hey @wolph. This isn't a bug. There's no column type called 'mixed'. you can see the supported data types here:
https://xaksis.github.io/vue-good-table/guide/configuration/column-options.html#type

Just some clarity: Default type is 'text', so it assumes if no type is specified, the data would be string. Table doesn't do the casting of type for you, so you might have to do this in prep work before supplying it to the table.

Perhaps it should do the overhead of casting internally? I'll keep this ticket open while we think about it.

@xaksis xaksis closed this as completed Aug 9, 2020
@xaksis xaksis reopened this Aug 9, 2020
@p0psicles
Copy link
Collaborator

I think you have the option of sanitizing your data, and go with the default string sort or number. Or use a sortFn function, and cast there. Although option 1 would win in performance.

@wolph
Copy link
Author

wolph commented Aug 9, 2020

Personally I would think that defaulting to a string type cast would be good. You should still be able to disable it for performance sake, but having a library that works with everything out of the box is a good thing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment