; although there's a workaround, it seems like this is still a bug, or at least unexpected behavior.
It looks like, if an element is hidden when the DOM is loaded, then messages from that binding will not passed around (even though the binding is generated). This status doesn't get reset even if the element is later re-displayed.
Starting on line 2618 of shiny.js:
// Return true if the object or one of its ancestors in the DOM tree has
// style='display:none'; otherwise return false.
function isHidden(obj) {
// null means we've hit the top of the tree. If width or height is
// non-zero, then we know that no ancestor has display:none.
if (obj === null || obj.offsetWidth !== 0 || obj.offsetHeight !== 0) {
return false;
} else if (getStyle(obj, 'display') === 'none') {
return true;
} else {
return(isHidden(obj.parentNode));
}
}
var lastKnownVisibleOutputs = {};
// Set initial state of outputs to hidden, if needed
$('.shiny-bound-output').each(function() {
if (isHidden(this)) {
initialValues['.clientdata_output_' + this.id + '_hidden'] = true; } else {
lastKnownVisibleOutputs[this.id] = true; initialValues['.clientdata_output_' + this.id + '_hidden'] = false; }
});
// Send update when hidden state changes
function sendOutputHiddenState() {
var visibleOutputs = {};
$('.shiny-bound-output').each(function() {
delete lastKnownVisibleOutputs[this.id]; // Assume that the object is hidden when width and height are 0
if (isHidden(this)) {
inputs.setInput('.clientdata_output_' + this.id + '_hidden', true); } else {
inputs.setInput('.clientdata_output_' + this.id + '_hidden', false); }
});
// Anything left in lastKnownVisibleOutputs is orphaned
for (var name in lastKnownVisibleOutputs) {
if (lastKnownVisibleOutputs.hasOwnProperty(name)) {
inputs.setInput('.clientdata_output_' + name + '_hidden', true);
}
}
// Update the visible outputs for next time
lastKnownVisibleOutputs = visibleOutputs;
}
It seems like, when loading, this .clientdata_output_<foo>_hidden flag gets set to true, and it does not get unset even if the element is later displayed through 'standard' JavaScript (e.g. $("#foo").show())
Although 'outputOptions(output, 'x', suspendWhenHidden=FALSE)' fixes it, it seems more like a workaround than a real solution...
Hopefully someone on the Shiny team has comments / a solution.