Displaying notes as actions to be checked in Dataview

I know that you can display all the task items in your vault using Dataview, but my vault is organized so that each note is a task action, and I’m treating task lists as subactions of that specific action. Here’s an example:

I would like to find a way to interact with my notes as if they are next actions I can uncheck as completed. Here’s as far as I’ve gone so far with this little experiment:

const actions = dv.pages('"Notes"')
function hello() {
	console.log('hello')
}

dv.table([
		"Item",
		"Status"],  
		actions.map(x => { 
							return [ 
								x.file.link, 
								`<input id="${x.file.name.replaceAll(' ', '_')} "type="checkbox" ${x.completed === true ? "checked" : ""} onchange="hello()"/>`
							]
						}
					)
		);	

See the result here.

In other words, I can visualize the notes as a series of tasks that can be checked and unchecked, but I would like to toggle the “completed” property to “true” or “false” when I interact with the checkbox. However, the mock function I included in the onchange event of the input tag does not work at all. In fact, when I take a look at the inspector, the input I put in my script is incomplete.

Is there something else I could try here?

Isn’t this almost the textbook example of what the metadata plugin does? Isn’t there an example in its documentation on how to have a button or box to trigger a value change in the origin note?

1 Like

Oh wow, I was not familiar with that plugin! Are you talking about this one? I was looking for the example that you mentioned in the documentation, but I couldn’t find it. Do you remember where you saw it?

It’s the metaedit plugin, and there’s indeed an example on its github page here where you can accomplish that with a button:

2 Likes

@woofy31 Duh… I keep mixing these two plugins as I discovered them at the same point in time. Thanks for doing my homework and locating the correct plugin.

1 Like

Thank you everyone for the help! I’ll play around to see how to make it work (I was also not familiar with the Buttons plugin, so it’s going to be fun learning also that :slight_smile: )

1 Like

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