I've been working for some days with Handsontable in Shiny and I got stuck in what I guess will be a very dumb question but I have not this much idea how to solve.
I have a Handsontable that has a custom function that allows searching and it works. It works but is not intuitive enough because you have to right-click on the table to pop the search option.
Because of this, I decided that I would like to have a textInput that does the same function but in a prettier way. I know that it should be related with an observeEvent of the input variable (input$searchId) but I have no idea of how to do it due to my lack of experience with Shiny and Handsontable.
This is the code from server.R that prints the table and that has a custom function that allows the user to search.
output$hot <-renderRHandsontable({rhandsontable(Dataset(),height = 600)%>%
hot_table( columnSorting = TRUE,highlightCol = TRUE, highlightRow = TRUE, search = TRUE) %>%
hot_context_menu(
customOpts = list(
search = list(name = "Search",
callback = htmlwidgets::JS(
"function (key, options) {
var aux = document.getElementById('searchId').value;
var srch = prompt(Search);
this.search.query(srch);
this.render();
}")))) })
And what I would like is to archive the same result but without having to right-click on the table and create a prompt.
Thank you so much,