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

Sort book listing via drag-and-drop #441

Open
Inquisitor-Ignotorum opened this issue Jun 8, 2024 · 2 comments
Open

Sort book listing via drag-and-drop #441

Inquisitor-Ignotorum opened this issue Jun 8, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@Inquisitor-Ignotorum
Copy link

Configuration: Windows 10, Lute v. 3.4.2 installed via pip

Hello. I was recently trying to figure out a way to re-organise my "Home" screen's book list in a way that fit my preferences, but the desired result could unfortunately not be produced by using the "Home" screen's sorting options. Using tags and then sorting by tags did not quite produce the intended outcome, so I had to add increasing numbers in the beginning of the title of each book and to then sort by title, to achieve the preferred order. That led to the following idea:

The user's experience could be improved by enabling them to sort the book listing in the "Home" screen and the book listing in the "Book Archive" screen via drag-and-drop, just like what can be done for each language's dictionaries. This feature would not replace the very useful sorting options which are already available.

This is different than what is outlined in issue #115.

Your thoughts would be welcomed.

Thank you very much for your work. I think that Lute is great and use it every day.

@jzohrab
Copy link
Collaborator

jzohrab commented Jun 8, 2024

Hi there, thanks very much for the issue.

I need to un-complicate some code first, per issue #442.

Lute uses DataTables for the listing library, and they do have a plug-in for drag-drop sorting. https://editor.datatables.net/examples/extensions/rowReorder - so it is def doable.

As you know, the backlog is long and I'm thinly stretched, but this is a good issue and I think others might like it as well. I can't prioritize anything, due to the nature of the project and life :-), so perhaps someone else would be interested in giving this a shot. I'll add some notes below, cheers!

@jzohrab jzohrab added the enhancement New feature or request label Jun 8, 2024
@jzohrab jzohrab added this to Lute-v3 Jun 8, 2024
@jzohrab
Copy link
Collaborator

jzohrab commented Jun 8, 2024

Notes for future:

  • One thing I'm not sure how to handle is how to do the initial sort of the books, when we add a new field books.BkSortNumber. Currently, the order is by the first column, which is the title. If we use that number as the sort number, then it will look odd for people who have archived books, like me, as the sort numbers will be non-contiguous. And if the sort numbers are changed to match the display somehow, we might end up with funny sort numbers.
  • archiving/unarchiving forces renumbering of fields
  • if people sort by title, the row numbers will be different -- but then if they reorder a row when sorted by some other field, the numbering will go crazy. e.g. when sorted by tags, the original sort numbers may become [11, 2, 32, 17 ...] ... what does it mean to move sort number 17 above sort number 11, in this scenario? Brutal problem, I don't think there's a good solution other than to disable reordering when things aren't sorted by sort number, and I don't know if it's possible to disable the sorting plugin like that.

In short, this isn't as trivial a problem as it appears it should be!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

2 participants