Bonus tip: How to present code properly in a forum post
If you want to showcase either markdown, or code blocks, or dataview queries properly in a forum post, be sure to add one line before and one life after what you want to present with four backticks, ````
. This will ensure that any other backticks (like for code blocks) is properly shown.
The clickOverride
parameter is calling the update
function of metaedit
, if I’m not mistaken. You could easily define a similar function, and do whatever you’d like in that function.
Your code is currently:
createButton({
app,
el: this.container,
args: {
name: “+”,
color: “green”},
clickOverride: {
click: update,
params: [‘A1’, (t.A1 + 1), t.file.path]
}
})
Which will end in a call like: update('A1', (t.A1 + 1), t.file.path)
Here is similar (but untested code):
function myUpdate(a, b, c) {
update(a, b, c)
}
createButton({
app,
el: this.container,
args: {
name: “+”,
color: “green”},
clickOverride: {
click: myUpdate,
params: [‘A1’, (t.A1 + 1), t.file.path]
}
})
This should do the same, but uses another function, myUpdate
. And this should then be expandable to be able to do extra stuff or other stuff if you’re so inclined.