-
Notifications
You must be signed in to change notification settings - Fork 754
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 dynamically added columns with numberSorter and semver #1610
Comments
Hi @corbosman! I think you'll need to change your parser. A version number of Maybe try this parser. I might be able to give better advice if you shared a demo of how dynamic columns are being added & removed. |
Im adding and removing columns using vue, i destroy the current tablesorter and init a new one each time a user adds/removes a column. The user selects a piece of data from a huge list of items (hundreds), which represents stuff like 'apache_versions', 'debian_versions', but also 'kernelmajorversion', which isnt semver. It's basically a server data selector where a datacenter admin could for instance quickly find "all servers with a system board revision of XXXXX and running ubuntu". Or simply "all versions of postgres that we run internally". I have a new idea though, the data items with version numbers seem to all have the string 'version' in their name. Im having vue add the sorter-version class to the th for all data with the version string. Then I can use a version parser and i'll try the below to parse digit-only version numbers. It exchanges the version string with a single digit that's sortable. At first glance it seems to be working ok. I'll probably get some complaints about non-digit version strings.
|
So this is what I'm using now which seems to work for all version-like strings that only contain digits.
|
Nice! Looks like that should work. |
I have an app where I dynamically add columns based on a dropdown by the user. The columns can be anything, strings, numbers, whatever. Im trying as best as I possibly can to make sense of sorting. These columns represent bits of data about servers, so a lot of the columns contain version numbers. But they can be anything from 4, 4.15, 4.14.1 etc. I tried using the numberSorter, as tablesorter detects all of these columns as numbers (even the 2.2.25 ones), but im running into an issue where numberSorter only receives 2.2 in that specific example. So it's being cast to a float or something.
I guess I could set all columns to text and use the textSorter, but then i run into problems needing to detect all different possible column type variations myself.
The text was updated successfully, but these errors were encountered: