Hi below is a reproducible example, I am trying to select rows in the renderDataTable (with rows highlighted that contain id and date) that will allow the user to select the id that will trigger a query based on the selected row numbers match rows with the original dataset display the points (this works ok as below).

However in my own example im linking to an external postgres database and where dat2 =subset(alldat, id %in% dat1) is displayed im using dat2 = dbGetQuery(con, paste(), sep=") etc... and it gets the data ok but does not update the plot when clicking on the rows unless its the same row selection. Do i need to trap or store the event each time I click on a row...? Any help will greatly received.

The issue is that within the postgres query the object pasted in the query is one value rather than a string of values. id= "1" "2" "4" as the user clicks on the selections, "1" "4" etc.... What is the best way to subset/append the data depending on the click id, plot, and add and remove the data points like the example but based on individual queries within the reactive environment?