Skip to content Skip to sidebar Skip to footer

Shiny.onInputChange Is Not A Function

I have code like is in my shiny app: $(function() { Shiny.onInputChange('initialHash', parseHashQuery()); }); function parseHashQuery() { var result = {}; location.hash.rep

Solution 1:

The solution was to use shiny event:

  $(document).on('shiny:sessioninitialized', function(event) {
    Shiny.onInputChange('initialHash', parseHashQuery());
  });

which was executed when Shiny.onInputChange was already defined.

Looking at the source code, Shiny is initialized in jQuery ready function but with timeout:

$(function() {
  // Init Shiny a little later than document ready, so user code can
  // run first (i.e. to register bindings)
  setTimeout(initShiny, 1);
});

Post a Comment for "Shiny.onInputChange Is Not A Function"