What I’m trying to do
For example, I have a dataviewjs code like this:
// dataview js block
function render(year, month){
// In this function, I want to render a new file and
// I want to make its frontmatter based on the 'year' and 'month'
// which are the params of this function
}
const {createButton} = app.plugins.plugins["buttons"]
const tableData = []
tableData.push([createButton({
app,
el: this.container,
args: {name: "Jan"},
clickOverride: {click: render, params: [2023, "Jan"]}
}),"Jan"])
dv.table(["button","month"], tableData)
When I click the button, a new file depending on ‘year’, ‘month’ and a custom template should be created.
template is like this:
---
tags:
- total
- month
year: <% year %>
month: <% month %>
---
\```dataviewjs
await forceLoadCustomJS()
const { DataviewUtils: utils } = customJS
const today = dv.date("now")
utils.renderMonthDetail(dv, dv.current()["year"], dv.current()["month"])
dasdasd
\```