DataviewJS tables do not always render

What I’m trying to do

I’m trying to create a dynamic table with DataviewJS. The table will be used in a concert note - a note that describes one particular concert that I’ve been to. The table will create a row for each artist that I saw at the show (artists are listed in frontmatter).

Here is an example of the metadata used in every concert note:

Index: 13
Artists:
- Disturbed
- Breaking Benjamin
- Alter Bridge
- Saint Asonia
Date: 2016-07-31
Venue: PNC Bank Arts Center
City: Holmdel
State: New Jersey
Country: United States

And here is the code that I use to create the table. For each artist that I’ve seen, I have a note dedicated to that artist in the ‘Artists’ folder. The code finds the artist note of each artist listed in the concert metadata, and then renders a table for those artists:

let res = new Array();
let page = dv.current();
let artists = dv.array(page.Artists);
dv.table( ["File", "Index"], 
  dv.pages('"Concerts/Artists"').where(page => artists.includes(page.Name))
.map(artist => [artist.file.link, artist.Index]))

The code works and does what I want it to do, the issue is the rendering of the table - sometimes it renders properly, but usually it does not. I’ll attach screenshots that show both scenarios:

Example of table not rendering correctly:

Screen Shot 2022-07-09 at 13.56.13

Example of table rendering correctly:

Any ideas as to what could be causing this? I’ve never encountered something that works some of the time in Obsidian / Dataview.

I have not seen anything like that! You might get more efficient help for this one on the “Discussions” page of the dataview GitHub. Some information that might be useful for them to figure it out:

  • what version of obsidian are you running?
  • is your dataview plugin up to date (this must be done manually in Settings → “Community Plugins” → button that says “Check for Updates”)?
  • Are you seeing this rendering issue in Live Preview, Reading mode, or both?
  • Does this still happen if you turn off community plugins other than dataview? Similarly, any custom theme you are using?

Good luck!

You are correct - I forgot I had installed ‘Notion Like Tables’, and as soon as I disabled it the code started working without exception. Thank you!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.