Skip to content

Bind button to a different note in dataviewjs #259

@Nitero

Description

@Nitero

Is your Feature Request Related to a Problem?

So I've found this issue which has a solution for how a text field can affect a different note.

This also works in a dataviewjs query to change the metadata of the specific note, for example to change the rating of a movie. However I can't get the same to work with buttons, since they can't really be created inline at the moment? Or is there a way to do this that Im missing? Seems like you can only create the buttons outside of js and then there is no way to change the binding target depending on what element in the dataviewjs query you are on

Describe the Feature you'd Like

I would like to define an inline button in dataviewjs so that I can have something like a "complete" button

dv.table(["Rating","Finish"],
  dv.pages()
    .where(p => p.type === "Movie")
    .sort(p => p.rating)
    .map(p => {

      //this works
      const rating = "`INPUT[number:" + p.file.name + "#rating]`";

      //doesnt work, no way to pass in binding to p.file.name?
      const finish = "`BUTTON[finish-button]`";

      return [rating,finish];
    })
);

Additional Context

I guess using the toggle works alright as a workaround for the button, but the downside is that you cannot properly label it apart from the table heading, so you can't really have multiple toggles in a cell either since you won't know which one does what

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions