I'm working on a custom app that can create child devices. I'm adding the option to remove a child device, and trying to implement it similar to how RM lets you remove an action: there's a dropdown that you can choose, and then it instantly removes the child.
Here's my example code in a dynamicPage section:
// List out the existing children
getChildDevices().each {
paragraph "${it.displayName.toString()}"
}
// Build a list of the children for use by the dropdown
def existingChildOptions = []
getChildDevices().each {
existingChildOptions << [(it.deviceNetworkId.toString()): it.displayName]
}
// If they've chosen a dropdown value, delete the child
if (settings.childToDeleteId) {
log.debug "Removing Child: ${settings.childToDeleteId}"
deleteChildDevice(settings.childToDeleteId)
app.removeSetting("childToDeleteId")
}
input(name: "childToDeleteId", type: "enum", title: "Remove a child", multiple: false, required: false, submitOnChange: true, options: (existingChildOptions))
First it lists out the children, then it has an enum input to select one. Right now it is deleting the child device. But I still see it in the list of paragraphs at the top until I refresh the browser.
Is there a command to cause a re-render of this page? Something like app.refresh() or something?