I have a issue not sure how complicated it is but I have been unsuccessful in finding a solution and I have spent some considerable time troubleshooting and Googling resolutions.
Here is my issue, I have a jQuery UI Slider on my page.
I insert a new value using Ajax and it basically rebuilds the Slider.
All that works perfect. The problem is any key bindings I had are removed. (I know the solution for this).
The problem comes where I remove a mouse event prior by changing it at the root of the widget.
I cannot just recall this after the Slider is rebuilt, I don't understand why but it just doesn't work as it did on the first page load.
Here is my code to disable the Slider click tracker.
// Disable the mouse tracking for ui-slider-handle(s)
$.widget('ui.slider', $.ui.slider, {
_mouseCapture: function(e) {
return (!$(e.target).is(this.element)) ? this._super(e) : false;
}
});
Nothing in there is specific to the slider itself since this changes the slider widget itself.
Just to be clear I am only looking at removing a certain binding mouse event to the Jui Slider.
The above code works at doing that, but it won't work once I rebuild the slider with a new value via Ajax.
$('#slider').unbind();
The above unbind() function removes all bindings and makes the slider not functional, just visual.
I solved it by adding 2 lines in my framework as framework specific code for Yii.
Yii::app()->clientScript->scriptMap['*.js'] = false;
Yii::app()->clientScript->scriptMap['*.css'] = false;
It doesn't allow for the scripts to get reinitialized on the page.