#Rerender Dialog

1 messages · Page 1 of 1 (latest)

cursive otter
#

I've got a Dialog with a file input, and the Dialog uses a handlebars template. How do I get the Dialog template to rerender/update after files have been selected and parsed?

Here's what I have under render for the Dialog.

render: async html => {
  let fileInput = document.querySelector('#savaged-json-files')
 
  fileInput.addEventListener('change', async (event) => {
    files = event.target.files
    const characters = []
    for (const file of files) {
      let json = file.text()
      let stringData = JSON.parse(json)
      characters.push(stringData)
    }
   // Update the dialog template here
 })
}
#

I got it!

const content = await renderTemplate("modules/savagedus-importer/templates/file-import.hbs", characters)

savagedInPrompt.data.content = content

savagedInPrompt.render(true)
#

Changed the value of data.content and rendered the Dialog again.