obsidian-table-sorting icon indicating copy to clipboard operation
obsidian-table-sorting copied to clipboard

Sorting not possible

Open merlinuwe opened this issue 1 year ago • 22 comments

I have this note in my TestVault. All plugins and css are disabled:

## 1 Tabelle mit erster Spalte

|   a | b   | c   |   d |
| --- | --- | --- | --- |
|   1 | 6   | A   |   F |
|   2 | 5   | B   |   E |
|   3 | 4   | C   |   D |
|   4 | 3   | D   |   C |
|   5 | 2   | E   |   B |
|   6 | 1   | F   |   A |

SYSTEM INFO: Obsidian version: v1.5.12 Installer version: v1.5.12 Operating system: Windows 10 Home 10.0.19045 Login status: not logged in Insider build toggle: off Live preview: off Base theme: dark Community theme: none Snippets enabled: 3 Restricted mode: off Plugins installed: 13 Plugins enabled: 1 1: Table Sorting v1.4.0

I reinstalled it, without success.

image

For me, sorting is not possible. What can I do to get it run again?

merlinuwe avatar May 24 '24 17:05 merlinuwe

Hi, thanks for providing all this information! Are there any errors in the developer log (Ctrl + Shift + I) that might be able to give us more of a direction?

Also, on a side note. The controls changed for the release you are using. You'd have to right click a column to select and sort. Select the columns to sort by multiple columns. Check the release notes for more info.

kraibse avatar May 24 '24 18:05 kraibse

No entries:

image

Clicking with the left or right mouse button does not change the sorting.

merlinuwe avatar May 24 '24 18:05 merlinuwe

It seems like the plugin is not enabled. When it's enabled it prints ( obsidian-table-sorting ) Plugin has finished loading. to the console. Please make sure the plugin is enabled in the community plugins section. If you dropped in the files while Obsidian was open, close it and reopen Obsidian to load the changes.

Aside from that, I copied and tried out your table source code and it works like charm. If everything was set up correctly you should see this:

image

kraibse avatar May 24 '24 19:05 kraibse

I believe it, but it does not work for me:

image

Restarted the vault.

(I know, your plugin was running some weeks before.)


When I active sortable plugin, task, dataview, I see some console entries:

image


I restarted the PC and switched on the Developer mode:

image

I see some output. -> the plugin runs. But it does not sort.

merlinuwe avatar May 24 '24 20:05 merlinuwe

I seem to have the problem "Did not find the contextmenu..."

whytong avatar Aug 22 '24 02:08 whytong

I seem to have the problem "Did not find the contextmenu..."

Thank you for your contribution. With that error message I already suspect the cause in the plugin. I will get back to you when it's solved.

Out of curiosity though, what hardware and how many plugins do you have?

kraibse avatar Aug 22 '24 05:08 kraibse

Quite some; here is my community-plugins.json:

[ "table-editor-obsidian", "obsidian-checklist-plugin", "chem", "dataview", "obsidian-dictionary-plugin", "cm-editor-syntax-highlight-obsidian", "obsidian-footnotes", "obsidian-frontmatter-tag-suggest", "obsidian-full-calendar", "obsidian-kanban", "obsidian-latex-environments", "obsidian-outliner", "recent-files-obsidian", "tag-wrangler", "obsidian-tasks-plugin", "obsidian-charts", "metadata-menu", "obsidian-style-settings", "obsidian-languagetool-plugin", "templater-obsidian", "obsidian-regex-replace", "find-and-replace-in-selection", "obsidian-linter", "obsidian-mind-map", "table-sorting" ]

whytong avatar Aug 22 '24 16:08 whytong

These are my plugins:

SYSTEM INFO: Obsidian version: v1.6.7 Installer version: v1.6.7 Operating system: Windows 10 Home 10.0.19045 Login status: not logged in Insider build toggle: off Live preview: off Base theme: dark Community theme: MagicUser v20.8.1 Snippets enabled: 58 Restricted mode: off Plugins installed: 188 Plugins enabled: 69 1: Set View Mode per Note v1.0.3 2: Android nomedia v0.1.0 3: Auto Link Title v1.5.4 4: Beautitab v1.6.1 5: Better Export PDF v1.9.2 6: Commander v0.5.1 7: Copy document as HTML v0.8.1 8: Creases v0.7.0 9: Custom Classes v2.6.1 10: Dictionary v2.22.0 11: Editing Toolbar v2.4.16 12: Editor Syntax Highlight v0.1.3 13: Enhancing Export v1.10.7 14: Excel to Markdown Table v0.4.0 15: Export Image plugin v2.3.10 16: File Explorer Note Count v1.2.2 17: Google Calendar v1.10.14 18: Linter v1.25.0 19: Local Backup v0.1.7 20: markdown export v1.0.24 21: Natural Language Dates v0.6.2 22: Navigate Cursor History v1.1.0 23: Number Headings v1.16.0 24: Omnisearch v1.24.1 25: Paste image rename v1.6.1 26: Quiet Outline v0.3.36 27: Recent Files v1.4.1 28: Sheet Plus v1.3.4 29: Show Current File Path v0.5.2 30: Sortable v0.3.1 31: Status Bar Organizer v2.1.2 32: Style Settings v1.0.8 33: Tag Wrangler v0.6.1 34: Tasks v7.9.0 35: Templater v2.4.2 36: Vault Changelog v0.1.0 37: Vault Statistics v0.1.3 38: Webpage HTML Export v1.8.01 39: Dataview v0.5.67 40: Docxer v2.0.1 41: Supercharged Links v0.12.1 42: Query Control v0.6.0 43: Note Toolbar v1.10.1 44: Refresh Preview v1.3.0 45: Hover Editor v0.11.20 46: Advanced URI v1.42.0 47: Find orphaned files and broken links v1.10.1 48: Multi Properties v1.1.2 49: Table Generator v1.4.1 50: Image in Editor v2.2.6 51: Quick Explorer v0.2.10 52: Dashboard navigator v1.1.1 53: Quick Switcher++ v4.4.0 54: Backlink Cache v1.8.1 55: Tab Switcher v1.4.0 56: Open File by Magic Date v0.1.2 57: Reset Font Size v1.0.2 58: Enhanced Symbols Prettifier v1.2.0 59: Typing Transformer v0.4.0 60: Image Converter v1.1.7 61: Actions URI v1.6.3 62: Advanced Tables v0.21.0 63: Auto Hide Cursor v1.1.0 64: Show Whitespace v0.2.2 65: Remember cursor position v1.0.9 66: Zoom v1.1.2 67: Gallery v0.5.8 68: Plugins Annotations v1.6.6 69: Custom Font Loader v1.5.5

merlinuwe avatar Aug 22 '24 18:08 merlinuwe

Alright, I've implemented a solution that was long overdue. Before integrating these changes into the main branch, I need you to test that this indeed fixed your issue.

I'm uploading the necessary files to this issue thread. Just replace the files in your obsidian-table-sorting plugin folder and restart your Obsidian to apply the changes.

Plugin files: obsidian-table-sorting_contextmenu-fix.zip

kraibse avatar Aug 26 '24 11:08 kraibse

No. I still have issues; I cannot see the context menu.

Here is the error msg:

Uncaught TypeError: Cannot read properties of undefined (reading 'contains')
    at eval (plugin:table-sorting:431:37)
    at Array.forEach (<anonymous>)
    at MutationObserver.eval (plugin:table-sorting:426:15)

And here is my SYSTEM Info, but it does not seem to be any conflict because I tried to disable all of them, same problem.

SYSTEM INFO:
	Obsidian version: v1.6.7
	Installer version: v1.6.3
	Operating system: Windows 10 Enterprise 10.0.22631
	Login status: not logged in
	Insider build toggle: off
	Live preview: on
	Base theme: light
	Community theme: Blue Topaz v2024071502
	Snippets enabled: 4
	Restricted mode: off
	Plugins installed: 40
	Plugins enabled: 24
		1: Checklist v2.2.13
		2: Chem v0.4.0
		3: Dataview v0.5.67
		4: Dictionary v2.22.0
		5: Editor Syntax Highlight v0.1.3
		6: Footnote Shortcut v0.1.3
		7: Frontmatter Tag Suggest v0.4.1
		8: Full Calendar v0.10.7
		9: Kanban v2.0.51
		10: Latex Environments v0.4.2
		11: Outliner v4.8.1
		12: Recent Files v1.4.1
		13: Tag Wrangler v0.6.1
		14: Tasks v7.9.0
		15: Charts v3.9.0
		16: Metadata Menu v0.8.7
		17: LanguageTool Integration v0.3.7
		18: Templater v2.4.2
		19: Regex Find/Replace v1.2.0
		20: Find and replace in selection v1.0.1
		21: Linter v1.25.0
		22: Mind Map v1.1.0
		23: Sortable v0.3.1
		24: Table Sorting v1.4.0

I do see the impact of the plug-in such that the table rows are highlighted when I move the cursor over a table, suggesting the plug in is loaded.

whytong avatar Aug 26 '24 17:08 whytong

No, the content of obsidian-table-sorting_contextmenu-fix,zip does not solve the problem. No messages in the console.

merlinuwe avatar Aug 27 '24 08:08 merlinuwe

@whytong Even though I tried to trigger that error message, I could not for the life of me reproduce it.

But as a side note, sortable and this plugin were not compatible with each other because of some event prevention on sortables end. Can't say if this has changed since then.


As for the general issue at hand, I'll have to try out a completely different approach that is shipped by the Obsidian API. Initially, I've skipped this solution because of some limitations that arose with my specific use case. Nevertheless, I'm giving it a try to see if it changes something for you.

I'm sure you are already aware but testing the plugin in a fresh vault with only this plugin installed would help me greatly. It would eliminate the need for checking any dependencies and external influences.

kraibse avatar Aug 27 '24 14:08 kraibse

New vault, all plugins are deactivated, Windows 10 Obsidian

image

No sorting possible, not with 1.4.0, not with your zip-package.

SYSTEM INFO: Obsidian version: v1.6.7 Installer version: v1.6.7 Operating system: Windows 10 Home 10.0.19045 Login status: not logged in Insider build toggle: off Live preview: off Base theme: dark Community theme: none Snippets enabled: 8 Restricted mode: off Plugins installed: 25 Plugins enabled: 1 1: Table Sorting v1.4.0

merlinuwe avatar Aug 27 '24 17:08 merlinuwe

@whytong Even though I tried to trigger that error message, I could not for the life of me reproduce it.

But as a side note, sortable and this plugin were not compatible with each other because of some event prevention on sortables end. Can't say if this has changed since then.

As for the general issue at hand, I'll have to try out a completely different approach that is shipped by the Obsidian API. Initially, I've skipped this solution because of some limitations that arose with my specific use case. Nevertheless, I'm giving it a try to see if it changes something for you.

I'm sure you are already aware but testing the plugin in a fresh vault with only this plugin installed would help me greatly. It would eliminate the need for checking any dependencies and external influences.

Sorry if I jumped into the thread, not sure whether merlinuwe and I have the same issue.

But I updated the installer to 1.6.7 and tried it on a new vault.

  1. Table Sorting works in a brand new vault.
  2. Table Sorting does not work in my old vault despite that I disabled all other plugins and CSS snippets. The error message says:
Uncaught TypeError: Cannot read properties of undefined (reading 'contains')        plugin:table-sorting:431 
    at eval (plugin:table-sorting:431:37)  
    at Array.forEach (<anonymous>)
    at MutationObserver.eval (plugin:table-sorting:426:15)

Is this discrepancy the cause you cannot reproduce the error? But I am not sure what else I can test.

whytong avatar Aug 28 '24 13:08 whytong

Complete new vault "kannweg". Only Table sorting plugin 1.4.0 installed, no css.

image

image

These settings

image

SYSTEM INFO: Obsidian version: v1.6.7 Installer version: v1.6.7 Operating system: Windows 10 Home 10.0.19045 Login status: not logged in Insider build toggle: off Live preview: off Base theme: adapt to system Community theme: none Snippets enabled: 0 Restricted mode: off Plugins installed: 1 Plugins enabled: 1 1: Table Sorting v1.4.0

RECOMMENDATIONS: Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.

This is your new *vault*.

Make a note of something, [[create a link]], or try [the Importer](https://help.obsidian.md/Plugins/Importer)!

When you're ready, delete this note and make the vault your own.

| a     | b     | c     | d     |
| ----- | ----- | ----- | ----- |
| 1     | a     | 4     | d     |
| 2     | b     | 3     | c     |
| 3     | c     | 2     | b     |
| 4     | d     | 1     | a     |

No sorting possible with 1.4.0

Error messages in console

image


Installed the files from the zip-file.

Same result, no sorting possible. But: Console shows nothing.

image

merlinuwe avatar Aug 28 '24 16:08 merlinuwe

It's progressively getting harder to debug this issue. Glad, we've got it working on an empty vault though. Wouldn't have thought that an issue of that persistence could arise.

Nevertheless, I want to know if you get any sort of hints that you've clicked a table when right clicking. Usually, there should be a little message popping up on the screen that you've clicked a table with its table ID. With dev mode enabled you'd get an additional log in the console.

If you came from a previous version of this plugin, the handling has changed significantly. Read through the changelogs here if you are still applying the previous method of sorting which would be left clicking the table headers.

@whytong As for you, I'd recommend completely removing the sortable folder from the plugin folder for now. I've found that the plugin has persistent changes that affect the vault even after the plugin was disabled. It is marked as deprecated by now if you didn't know.

kraibse avatar Aug 28 '24 20:08 kraibse

No, there is no context menu visible.

The console shows this after activating in the settings of the plugin.

image

merlinuwe avatar Aug 28 '24 21:08 merlinuwe

Okay, wow. I've just noticed that you use the preview/reading mode where not even the default context menu appears. It's just something I never used in my entire Obsidian lifecycle.

When you switch to editing mode, I assume, you should be able to see and sort your table.

That just means that I have to clean up the remaining reading mode styling which currently indicates a possible interaction. I also have to find a way to make it work with the reading view. I think we've come a good bit closer to a solution.

kraibse avatar Aug 28 '24 21:08 kraibse

No, I cannot sort in editing mode.

image

image

merlinuwe avatar Aug 31 '24 20:08 merlinuwe

Related to the issue #26 where you can't sort in the source editing mode. Make sure to have this toggle enabled.

image

kraibse avatar Aug 31 '24 20:08 kraibse

Interesting, your plugin works, but only in Live-preview mode. What do you think about mentioning this in the documentation?

merlinuwe avatar Sep 03 '24 19:09 merlinuwe

You are right, thank you for the suggestion. That'll clear up some of the confusion.

So to summarize this issue you are having: Since you are using the preview mode and source edit mode, you can't use the sorting plugin. This issue you are having is otherwise not related to any other plugins or configurations in your vault. It does work though when you are using the live preview edit mode. Does that sum up your situation?

kraibse avatar Sep 04 '24 21:09 kraibse