Dataviewjs: table with sort buttons and filter fields?

It’s always hard to understand how much work has been done to research before asking a question like yours, and I answered when on the move and didn’t have the time to do the search for a solution which might fit your needs, but in the thread below one option by @reaty , with a variant by @Anwen , is presented doing some of this.


Now for a more general approach to this question, and that is that I know of two main approaches to handling such a case, and that is either on the “serverside” where the server (or main script in our case) handles all the action, or “clientside” where the main script attaches javascript to the table itself to do it after presenting all the data to the client.

The main difference is that doing it serverside requires reloading of stuff all the time when changing the parameters, and when being on clientside you’ll need to load all of your data into the page to allow it to handle everything afterwards.

Sadly, neither option is directly supported by Obsidian (or Dataview), and you’ll need to some extra code to handle it. I’ve not seen any recent generic code doing this, with the exception of the builtin handling by some plugins. So you’re left with either complementing scripts like that above by reaty and/or anwen, or doing it yourself. In other words, you need to be know some coding, and there are many disturbances on the way…

When it comes to plugins, you might want to look into either of the following plugins Dataloom, DB Folders and/or Metadata menu. These offer various tools to handle data similar to Dataview, and I believe they offer some filter/sorting capabilities if you’re able to present your data using those tools.

Disclaimer: I’ve not used any of those tools extensively, only Dataview, so I can’t warrant for the stability or usefulness of either one, but I do know they offer some of the functionality you want.


With regards to Dataview though, I’ve been thinking to review/look into the solution I linked to above as it seems promising, but the need hasn’t been high enough that I’ve bothered. In most cases, I’ve just changed the query itself if I wanted a different sorting/filtering, which in my case has been good enough as I don’t really analyse the data, more present various bits and pieces.

There is however one caveate with Obsidian, which makes me really wonder whether Obsidian is the tool for analysing larger amount of data clientside, and that is for ordinary documents Obsidian does a lazy load of the document, and if you scroll beyond a certain amount it unloads the earliest data. Whether this comes to play in a query based data table I’m not sure, but I’ve seen and heard of it happening for any larger static table/note.

So if I would venture into something like this, I’d first look into whether the data stays loaded in the first place before doing it clientside, and if keeping it serverside you need to store your filter/sort parameters into the frontmatter or similar, and keep doing Dataview: Rebuild current view (or similar manipulation of the DOM) since your script doesn’t really change causing caching issues to occur if you don’t trigger manual rebuilds.