A bit more on this issue of javascript in Modules. It is curious to me that the ns comes into play at all in this case since all of the javascript functionality is occurring WITHIN the Module. Anyway, Carl has hit on something here as, though I was not able to get ns("select_button") to work, I can get this to work if I hard-code the name space id. For example, if I am using the name space id of "demo", then the following code does provide the desired functionality:
mutate(Delete = shinyInput(actionButton, nrow(insectData()), '', label = "Delete", onclick = 'Shiny.onInputChange("demo-select_button", this.id)')) That is a huge step forward, but obviously it is counter to the point to have to hard-code the ns id into Module functions. I am still not sure why Carl's excellent suggestion of adding
ns("select_button") (e.g., below) did not work but if anyone has insight on where I am going wrong with my syntax your comments would be appreciated.
mutate(Delete = shinyInput(actionButton, nrow(insectData()), '', label = "Delete", onclick = 'Shiny.onInputChange(ns("select_button"), this.id)')) Thanks!