mycontroller-org / mycontroller-v1-legacy

The Open Source Controller
http://www.MyController.org
Apache License 2.0
147 stars 90 forks source link

Numeric columns sorted alphabetically #391

Closed BogusException closed 6 years ago

BogusException commented 7 years ago

A tiny issue, to be sure. When sorting columns, as in the EUI column in the example, the sort is the default java sort, which is not numeric. There are only a few places where this is noticeable (EUI, Library version, Version, etc.)

mycontrollersort

More of an FYI...

pat :)

jkandasa commented 7 years ago

@BogusException Thanks for reporting this issue. In MyController EUI is a String column. Hence it reports as string sort, not numeric sort. Sorting has been done with this generic lines, hence it is difficult to manage if introduce new raw query for node EUI alone.

What do you think?

BogusException commented 7 years ago

Jeeva, Thanks for writing. I am only bringing this to your attention as a "FYI", and not as anything critical. In fact, you may prefer this action for some reason.

I program in lots of languages, and in Java there is a way to tell that might help with other alpha-numeric sorting in GUI. A small routine written by David Koelle called AlphanumComparator seems to work under my tests (so far just IdeaJ). It's really small, and 100% native.

The file I'll attach (AlphanumComparator.java) is 100% ready to go as-is, as it has a test in main() already.

NOTE: Due to the web server SW, I had to zip it, so it is AlphanumComparator.zip)

AlphanumComparator.zip

Is this something that would work? I must admit I have not analyzed any of your source code. Forgive me if this approach is therefore crazy. :)

Thanks!

pat :)

P.S. The nice thing about this approach is that you can call this comparator on any column you wish to sort on-string or otherwise! :)

jkandasa commented 7 years ago

@BogusException Thank you! AlphanumComparator looks great! However, the sorting option not controlled by Java here. It is done on SQL part. Here we are using OrmLite to communicate with the database.

We have to check on OrmLite, is it possible to integrate AlphanumComparator.

BogusException commented 7 years ago

Jeeva, I wear lots of hats. Just let me know which RDBMS, and I'll post query solutions/ideas. There are several approaches to choose from.

For security, I'm cool with an email. Your call.

pat :)

jkandasa commented 7 years ago

@BogusException

I wear lots of hats. Just let me know which RDBMS, and I'll post query solutions/ideas. There are several approaches to choose from.

We use OrmLite to avoid raw SQL queries. OrmLite supports for many databases. We no need to care raw SQL queries.

Thank you for your support. you can reach me at the email, jkandasa at gmail dot com

BogusException commented 7 years ago

I have not forgotten, just slammed, so fun stiff has to wait... :(

On Aug 15, 2017 11:19 PM, "Jeeva Kandasamy" notifications@github.com wrote:

@BogusException https://github.com/bogusexception

I wear lots of hats. Just let me know which RDBMS, and I'll post query solutions/ideas. There are several approaches to choose from.

We use OrmLite http://ormlite.com/ to avoid raw SQL queries. OrmLite supports for many databases. We no need to care raw SQL queries.

Thank you for your support. you can reach me at the email, jkandasa at gmail dot com

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mycontroller-org/mycontroller/issues/391#issuecomment-322656306, or mute the thread https://github.com/notifications/unsubscribe-auth/AILut8bqASXI48j1sJ4NduhzakKnivbzks5sYl_OgaJpZM4Ouksk .

jkandasa commented 6 years ago

@BogusException I am closing this issue, as currently, we do not have a custom query to for select. Everything handled by ORMLite.