Travel Mapping

Web Design Discussion => General Web Design Discussion => Topic started by: Jim on May 31, 2022, 10:42:21 pm

Title: New table sorting library
Post by: Jim on May 31, 2022, 10:42:21 pm
Many tables in TM are sortable by different columns by clicking on the column header.  The table sorting library we have been using for years has had some problems.  I've gone through and replaced all sortable tables with the one at https://github.com/tofsjonas/sortable .

Please try sorting tables on various pages on the staging server, https://tmstage.teresco.org/ , and let me know if you notice any problems.  Functionality should be very similar to what we had before, except it should work more consistently. If things are looking good after a short testing period, I'll install this version on the main site.
Title: Re: New table sorting library
Post by: Markkos1992 on June 01, 2022, 06:39:39 am
Is the functionality there yet?  The tmstage site shows an ongoing update.
Title: Re: New table sorting library
Post by: Jim on June 01, 2022, 07:36:05 am
Is the functionality there yet?  The tmstage site shows an ongoing update.

Should be.  The ongoing update messaging was a remnant of a previous test of something else, which I've now removed.
Title: Re: New table sorting library
Post by: Markkos1992 on June 01, 2022, 08:15:54 am
The total clinchable in the stats table for a region IMO should not be sortable.  Nothing else noticeable from what I have seen.

I would like to be able to sort the line at the top of the Route Finder, but I presume that may be a loading issue.
Title: Re: New table sorting library
Post by: michih on June 01, 2022, 08:56:46 am
The user page table content should be right-aligned again.

The total clinchable in the stats table for a region IMO should not be sortable.

Why?
Title: Re: New table sorting library
Post by: Markkos1992 on June 01, 2022, 11:05:15 am
The total clinchable in the stats table for a region IMO should not be sortable.
Why?

Personally, I do not like it getting in the way of usernames especially if I ever want to use the data in a personal spreadsheet.
Title: Re: New table sorting library
Post by: michih on June 01, 2022, 12:04:52 pm
@Jim, have you changed anything in the last three hours? The user page (https://tmstage.teresco.org/user/?u=michih) tables are sorted by region and system name now. I'm quite sure that it was by clinched miles (region) and % clinched three hours ago - just as it should be!
Title: Re: New table sorting library
Post by: michih on June 01, 2022, 12:05:53 pm
The total clinchable in the stats table for a region IMO should not be sortable.
Why?

Personally, I do not like it getting in the way of usernames especially if I ever want to use the data in a personal spreadsheet.

You don't need to sort it if you don't want to. I thinkt it's fine that it's possible.
Title: Re: New table sorting library
Post by: Jim on June 01, 2022, 01:07:39 pm
@Jim, have you changed anything in the last three hours? The user page (https://tmstage.teresco.org/user/?u=michih) tables are sorted by region and system name now. I'm quite sure that it was by clinched miles (region) and % clinched three hours ago - just as it should be!

I haven't, but I bet I need to specify an initial sorting that differs from the order that comes out of the DB in those cases.
Title: Re: New table sorting library
Post by: Jim on June 01, 2022, 01:10:15 pm
The total clinchable in the stats table for a region IMO should not be sortable.  Nothing else noticeable from what I have seen.

Agreed, that should not move from the top.  I will see what I can do.

Quote
I would like to be able to sort the line at the top of the Route Finder, but I presume that may be a loading issue.

If I understand what you mean, I think that shouldn't be too hard.  So you'd like to be able to sort by each of the column headers on findroute.php?  I just have to make sure the filter drop-downs are excluded.
Title: Re: New table sorting library
Post by: Markkos1992 on June 01, 2022, 01:44:05 pm
Quote
If I understand what you mean, I think that shouldn't be too hard.  So you'd like to be able to sort by each of the column headers on findroute.php?  I just have to make sure the filter drop-downs are excluded.

Basically.
Title: Re: New table sorting library
Post by: Jim on June 01, 2022, 08:08:08 pm
@Jim, have you changed anything in the last three hours? The user page (https://tmstage.teresco.org/user/?u=michih) tables are sorted by region and system name now. I'm quite sure that it was by clinched miles (region) and % clinched three hours ago - just as it should be!

I haven't, but I bet I need to specify an initial sorting that differs from the order that comes out of the DB in those cases.

The version on tmstage should now sort as it did before.

Is this the behavior we want?  I am not sure why the by-region table sorts by distance traveled while the by-system sorts by % traveled.
Title: Re: New table sorting library
Post by: formulanone on June 01, 2022, 09:05:43 pm
Sorting by percentages for each region puts the values in order by the first or second digit. This means that 100.00% values appear after the 19-11.x% values, but all 10.xx% values appear after the 100%. Then 1.xx% values appear after 10%, instead of below the 9.99-2.00%, et cetera.

Otherwise, I do like the ability to sort the column headers (for example, finding the longest or shortest routes in a system).
Title: Re: New table sorting library
Post by: Jim on June 01, 2022, 10:39:48 pm
I think I've fixed all the problems mentioned here, and added column sorting functionality on findroute.  Check out the current version on tmstage and let me know if I missed anything.
Title: Re: New table sorting library
Post by: Markkos1992 on June 01, 2022, 11:37:40 pm
At the top of the page, the stats page is not showing the color on distance traveled for me for active only now.

I am also getting an "out of memory" error whenever I try to use the route finder.  I want to think it was something on my end, but I am unsure.
Title: Re: New table sorting library
Post by: Jim on June 02, 2022, 07:30:40 am
At the top of the page, the stats page is not showing the color on distance traveled for me for active only now.

Fixed.

Quote
I am also getting an "out of memory" error whenever I try to use the route finder.  I want to think it was something on my end, but I am unsure.

Works for me, but I've only tested so far on one high-end MacBook Pro.  It's possible that we won't be able to use the sortable.js functionality on a table that starts with 90,000+ rows without overwhelming memory capabilities of many browsers.
Title: Re: New table sorting library
Post by: Markkos1992 on June 02, 2022, 07:39:05 am
Maybe it is the 90,000 rows, but the current version on the main Travel Mapping site is still working fine for me....

It seems to happen in the tmstage version when I click in the route name search field or elsewhere.
Title: Re: New table sorting library
Post by: Jim on June 02, 2022, 10:28:39 am
Maybe it is the 90,000 rows, but the current version on the main Travel Mapping site is still working fine for me....

It seems to happen in the tmstage version when I click in the route name search field or elsewhere.

I think it's the extra memory used when the sortable code is applied - it attached things to every row.  I could see this easily doubling or more the memory requirements in JS to store and deal with the sorting of the table compared to the version that didn't have this.  Remember that the current production version doesn't support sorting at all.
Title: Re: New table sorting library
Post by: Markkos1992 on June 02, 2022, 12:05:11 pm
I guess it is best to go without sorting the Route Finder for now until we can find ways to reduce memory to do it.  We can already somewhat sort it beyond the route name anyway so it is not that huge of a deal to be able to sort the columns.
Title: Re: New table sorting library
Post by: Jim on June 02, 2022, 01:52:20 pm
I've got a version of findroute on tmstage now that puts in a button you can use to enable column sorting.  I don't think it should have any memory (or other) resource utilization beyond what the production version has until you click that button to turn on the functionality.
Title: Re: New table sorting library
Post by: Markkos1992 on June 02, 2022, 02:01:33 pm
Thank you.  The Route Finder on tmstage now works fine for me without sorting.
Title: Re: New table sorting library
Post by: michih on June 02, 2022, 02:59:06 pm
@Jim, have you changed anything in the last three hours? The user page (https://tmstage.teresco.org/user/?u=michih) tables are sorted by region and system name now. I'm quite sure that it was by clinched miles (region) and % clinched three hours ago - just as it should be!

I haven't, but I bet I need to specify an initial sorting that differs from the order that comes out of the DB in those cases.

The version on tmstage should now sort as it did before.

Is this the behavior we want?

I think so.

I am not sure why the by-region table sorts by distance traveled while the by-system sorts by % traveled.

I'm used to it and like it as-is. I don't wanna see this being changed.
Title: Re: New table sorting library
Post by: michih on June 02, 2022, 03:06:39 pm
I've got a version of findroute on tmstage now that puts in a button you can use to enable column sorting.  I don't think it should have any memory (or other) resource utilization beyond what the production version has until you click that button to turn on the functionality.

It doesn't run out of memory for me but it takes a lot of power (browser slows down) and it's not working correct nor is usable (sorting takes 3-15 seconds and I easily managed that sorting by tier was a total mess 2-2-2-3-3-3-3-2-2-2....). There is no added value (right now).
Title: Re: New table sorting library
Post by: Jim on June 02, 2022, 08:58:54 pm
I've installed the latest on the production server, including the button that turns on optional sorting for findroute.  I think everything else is as good as or better than it was before, and no one who doesn't want to use the sorting on findroute is forced to press the button to turn it on.
Title: Re: New table sorting library
Post by: michih on June 03, 2022, 11:51:35 am
It seems that HB (https://travelmapping.net/hb/) systems are sorted by code instead of country (first) + tier (second) now. Since the country column is the first one, it starts with Netherlands, followed by Africa, Finland and Albania now.
Title: Re: New table sorting library
Post by: Jim on June 03, 2022, 03:47:28 pm
It seems that HB (https://travelmapping.net/hb/) systems are sorted by code instead of country (first) + tier (second) now. Since the country column is the first one, it starts with Netherlands, followed by Africa, Finland and Albania now.

Initial sort is now however it came out of the DB.  I can pretty easily make it sort the way it was before, if that's the preference.  I don't know how people tend to look at that list.  I always just search for the system code I am looking for.
Title: Re: New table sorting library
Post by: michih on June 03, 2022, 03:57:01 pm
It seems that HB (https://travelmapping.net/hb/) systems are sorted by code instead of country (first) + tier (second) now. Since the country column is the first one, it starts with Netherlands, followed by Africa, Finland and Albania now.

Initial sort is now however it came out of the DB.  I can pretty easily make it sort the way it was before, if that's the preference.  I don't know how people tend to look at that list.  I always just search for the system code I am looking for.

I think we should keep it as-was because people are used to it. We can change it if there is any improvement but I don't see it. The system code is just a "TM internal code". Sure, old hands are used to the code but newbies don't. Newbies likely look for the country or region first.
Title: Re: New table sorting library
Post by: Jim on June 03, 2022, 04:55:41 pm
While I'm in hb/index.php again, any thoughts on the current practice in the "Country" column that any country name longer than 15 characters is replaced by its 3-character code?
Title: Re: New table sorting library
Post by: si404 on June 03, 2022, 05:39:27 pm
While I'm in hb/index.php again, any thoughts on the current practice in the "Country" column that any country name longer than 15 characters is replaced by its 3-character code?
It's fine for USA, obviously. DRC is OK. But TTO, STP, etc are a bit "huh?".
Title: Re: New table sorting library
Post by: Jim on June 03, 2022, 10:10:27 pm
Now on tmstage is a version of hb/index.php that sorts by default first by country, then breaks ties with tier, then breaks ties with system name.  If no one notices any problems with that on Saturday, I'll install it on the main server.