I am trying to extend the sliderInput()
object with some specific javascript behavior. In R, I have made a new object SliderInputEnhanced
that adds enhanced
to the class attribute generated by sliderInput()
.
<input class="js-range-slider enhanced" ... />
Subsequently, I am writing Shiny binders as described here. I am mainly interested in using the onFinish callback of IonRangeSlider. This is my current code:
// step i
var binding = new Shiny.InputBinding();
// step ii
$.extend(binding, {
find: function(scope) {
// find all instances of class
return $(scope).find(".js-range-slider.enhanced");
},
initialize: function(el){
var irs = $(el);
var data = irs.data();
data.onFinish = function (data, scope) {
// Some specific code...
};
irs.ionRangeSlider(data);
}
});
// step iii
Shiny.inputBindings.register(binding);
This approach fails in the browser with "Uncaught Not implemented" from input_bindings.js
on the following line: this.getValue = function(el) { throw "Not implemented"; };
Subsequently, I would have to implement the rest of the binder functions such as getValue()
, but as I already stated, I merely want to extend the current js-range-slider
with as little overhead as possible. What options do I have? Is my current approach sane?