I have a page with kendoui slider, where i am checking if slider value is valid inside slider change event.
If value isn`t valid, i want to roll back slider value to previous value,
But every time i set slider value (roll back to previous value) inside change event it doesn't work.
For instance, mySlider initial value is 2.
The user is trying set the value to 10 but my validation function returns false (illegal value) and set my Slider back to it's initial value (2).
For some reason, right after that, the value of my Slider has been set up to 10 (the user choise) again(!!)
So practically my validation function has no meaning!!
It happens inside kendo.all.js in the function :
trigger: function (eventName, e) {
var that = this, events = that._events[eventName], idx, length;
if (events) {
e = e || {};
e.sender = that;
e._defaultPrevented = false;
e.preventDefault = preventDefault;
e.isDefaultPrevented = isDefaultPrevented;
events = events.slice();
for (idx = 0, length = events.length; idx < length; idx++) {
events[idx].call(that, e); ////////////////////////////////////////////////Here it change back to the user choise
}
return e._defaultPrevented === true;
}
return false;
},
My Code:
var slider =$("#slider").kendoSlider({
orientation: "vertical",
smallStep:1000,
largeStep:5000,
min:0,
max:100000,
value:50000,
change:Calc
});
function Calc(e){
if (!(IsValid(e.value)))
{
$("#slider").data("kendoSlider").value(prevVal);
}
} ////////////////////////////////////////////////Here it calls to:trigger: function (eventName, e) which written above
Is there some any way to do it?
Tanks.