Skip to content

Commit

Permalink
Trigger shiny:visualchange in doSendOutputHiddenState() as well. Adde…
Browse files Browse the repository at this point in the history
…d a 'visible' property to the event object.
  • Loading branch information
yihui committed Aug 31, 2015
1 parent da76a84 commit 838e132
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion srcjs/init_shiny.js
Expand Up @@ -256,6 +256,7 @@ function initShiny() {
var $this = $(this), binding = $this.data('shiny-output-binding');
$this.trigger({
type: 'shiny:visualchange',
visible: !isHidden(this),
binding: binding
});
binding.onResize();
Expand Down Expand Up @@ -301,12 +302,19 @@ function initShiny() {
$('.shiny-bound-output').each(function() {
delete lastKnownVisibleOutputs[this.id];
// Assume that the object is hidden when width and height are 0
if (isHidden(this)) {
var hidden = isHidden(this), evt = {
type: 'shiny:visualchange',
visible: !hidden
};
if (hidden) {
inputs.setInput('.clientdata_output_' + this.id + '_hidden', true);
} else {
visibleOutputs[this.id] = true;
inputs.setInput('.clientdata_output_' + this.id + '_hidden', false);
}
var $this = $(this);
evt.binding = $this.data('shiny-output-binding');
$this.trigger(evt);
});
// Anything left in lastKnownVisibleOutputs is orphaned
for (var name in lastKnownVisibleOutputs) {
Expand Down

0 comments on commit 838e132

Please sign in to comment.