Skip to content

Commit 838e132

Browse files
committed
Trigger shiny:visualchange in doSendOutputHiddenState() as well. Added a 'visible' property to the event object.
1 parent da76a84 commit 838e132

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

srcjs/init_shiny.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ function initShiny() {
256256
var $this = $(this), binding = $this.data('shiny-output-binding');
257257
$this.trigger({
258258
type: 'shiny:visualchange',
259+
visible: !isHidden(this),
259260
binding: binding
260261
});
261262
binding.onResize();
@@ -301,12 +302,19 @@ function initShiny() {
301302
$('.shiny-bound-output').each(function() {
302303
delete lastKnownVisibleOutputs[this.id];
303304
// Assume that the object is hidden when width and height are 0
304-
if (isHidden(this)) {
305+
var hidden = isHidden(this), evt = {
306+
type: 'shiny:visualchange',
307+
visible: !hidden
308+
};
309+
if (hidden) {
305310
inputs.setInput('.clientdata_output_' + this.id + '_hidden', true);
306311
} else {
307312
visibleOutputs[this.id] = true;
308313
inputs.setInput('.clientdata_output_' + this.id + '_hidden', false);
309314
}
315+
var $this = $(this);
316+
evt.binding = $this.data('shiny-output-binding');
317+
$this.trigger(evt);
310318
});
311319
// Anything left in lastKnownVisibleOutputs is orphaned
312320
for (var name in lastKnownVisibleOutputs) {

0 commit comments

Comments
 (0)