mirror of
https://github.com/rstudio/shiny.git
synced 2026-04-07 03:00:20 -04:00
Revert "Simpler fix for updating hidden sliders (#1010)"
This reverts commit 4e1caee7da.
See https://github.com/rstudio/shiny/issues/1010#issuecomment-169971201
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
// Necessary to get hidden sliders to send their updated values
|
||||
function forceIonSliderUpdate(slider) {
|
||||
if (slider.$cache && slider.$cache.input)
|
||||
slider.$cache.input.trigger('change');
|
||||
else
|
||||
console.log("Couldn't force ion slider to update");
|
||||
}
|
||||
|
||||
var sliderInputBinding = {};
|
||||
$.extend(sliderInputBinding, textInputBinding, {
|
||||
find: function(scope) {
|
||||
@@ -52,9 +60,10 @@ $.extend(sliderInputBinding, textInputBinding, {
|
||||
} else {
|
||||
slider.update({ from: value });
|
||||
}
|
||||
forceIonSliderUpdate(slider);
|
||||
},
|
||||
subscribe: function(el, callback) {
|
||||
$(el).on('change.sliderInputBinding update.sliderInputBinding', function(event) {
|
||||
$(el).on('change.sliderInputBinding', function(event) {
|
||||
callback(!$(el).data('updating') && !$(el).data('animating'));
|
||||
});
|
||||
},
|
||||
@@ -84,6 +93,7 @@ $.extend(sliderInputBinding, textInputBinding, {
|
||||
$el.data('updating', true);
|
||||
try {
|
||||
slider.update(msg);
|
||||
forceIonSliderUpdate(slider);
|
||||
} finally {
|
||||
$el.data('updating', false);
|
||||
}
|
||||
@@ -195,6 +205,7 @@ $(document).on('click', '.slider-animate-button', function(evt) {
|
||||
val.to = val.from + (slider.result.to - slider.result.from);
|
||||
|
||||
slider.update(val);
|
||||
forceIonSliderUpdate(slider);
|
||||
};
|
||||
var sliderStep = function() {
|
||||
// Don't overshoot the end
|
||||
@@ -205,6 +216,7 @@ $(document).on('click', '.slider-animate-button', function(evt) {
|
||||
val.to = Math.min(slider.result.max, slider.result.to + slider.options.step);
|
||||
|
||||
slider.update(val);
|
||||
forceIonSliderUpdate(slider);
|
||||
};
|
||||
|
||||
// If we're currently at the end, restart
|
||||
|
||||
Reference in New Issue
Block a user