I stumbled on a very similar problem not long ago, although it affected an input
element. See my question for more information, as well as the linked Google group discussion.
Basically, the problem was that Shiny loses track of a reactive
element if it is hidden when loading the DOM
(not sure if this is what happens in your case).
Anyway, you might want to try 2 possible solutions.
First one is to trigger the
shown
event when showing thetable
div. This solution is more fine-grained as it allows you to control at every moment whether to react or not to any hidden element. To do this just change yourJavascript
to do following:$("#table").show().trigger('shown');
The other possibility is to instruct Shiny not to ignore the
table
div when it is hidden. This solution will make any affected element react always. To achieve this change yourserver.R
file to include this line:outputOptions(output, 'table', suspendWhenHidden=FALSE)