efemkay / obsidian-modular-css-layout

CSS Layout hack for Obsidian.md
https://efemkay.github.io/obsidian-modular-css-layout/
GNU General Public License v3.0
918 stars 74 forks source link

Apply a two column in dataview group by #40

Open vkbytes opened 1 year ago

vkbytes commented 1 year ago

I have a dataview query which returns a list of files grouped by tags. I want to apply a two-column-list-block or a three-column-list-block based on the group by tags such that each #TAG is a list with the files as its sublist. The query is on a note below a a H2 Header. Looks like this not possible. However I see that the dashboard++ script does this correctly.

Example:

Testing a List of Tags

LIST rows.file.link
FROM #TAGNAME
SORT file.ctime ASC
FLATTEN file.etags AS tags GROUP BY tags
efemkay commented 1 year ago

hey @vkbytes,

  1. i don't personally use the dashboard++ by i follow it. i'm not sure which part that actually has that two column or multi column list part -- perhaps u can share with me the particular screenshot?
  2. btw, afaik, i don't think it's possible to target specific dataview block using markdown attributes (i.e. two-column-list-block) but we can have frontmatter style declaration. below is a quick snippet for you to make it work with the above dataview query. Perhaps i might include in the later update

here's the css. save it somewhere

.dv-sublist-cols ul.dataview.list-view-ul > li > ul {
    columns: 10rem;
    column-gap: 2rem;
}

here's a sample markdown

---
cssClass: dv-sublist-cols
---

```dataview
list rows.file.link
from #PermanentNote
FLATTEN file.etags as tags
GROUP BY tags
SORT Modified DESC


here's what it looks like
![image](https://github.com/efemkay/obsidian-modular-css-layout/assets/42369515/9c30b6d5-c8f7-4f42-b31e-d670f1c3a9e9)