Hello,
I’ve gone through countless threads and nothing seems to be able to help me resolve my very specific issue.
Context
I’ve got a folder housing separate notes containing titles of series I’m currently reading. Each note has a single frontmatter property which is chapter
that has a numerical value. Pretty straightforward.
See image:
What I’m trying to do
I’ve got a completely separate note called where I’m trying to setup an organised table view to track what I’m reading and which chapter I’m on, and the kicker is that I’m trying to incorporate incremental buttons which should theoretically target and update the chapter
property of that specific series.
Raw code:
label: "+1"
hidden: true
id: "count-increment"
style: default
actions:
- type: updateMetadata
bindTarget: Absolute Regression#chapter
evaluate: true
value: "x + 1"
let pages = dv.pages('"Manhwa"').groupBy(p => p.file.name.substring(0,1).toUpperCase());
let button = "`BUTTON[count-decrement, count-increment]`";
for (let group of pages.sort(g => g.key)) {
dv.header(3, group.key);
dv.table(["Series","Chapter","Button"],
group.rows
.map(b => [
b.file.name,
b.chapter,
button
]
)
);
}
Preview Snippet:
Things I have tried
The button is just the standard count increment code, and the dataviewjs
snippet is what I’m currently using to query from the entire Manhwa
folder.
You can see from the code snippet above I was testing out the bind target functionality and was able to specifically get it to update Absolute Regression#chapter
metadata, though my biggest current issue lies in how to pass this value dynamically so that each button will target the series in the same row the button is in.
e.g. if I clicked the +1
next to the “Bones” series, it should bind to Bones#chapter
.
My thinking was maybe some way to read the sibling HTML element and pass that value somehow to the meta-bind-button
, but I’m at a huge loss in how to get everything working in conjunction.
Maybe I’m thinking too small and need to refactor the entire structure to work differently.
I hope I’ve explained my goals and issues clearly, and I’m really appreciative of any advice that can lead me closer to a solution.
Thank you!