set slider value inside change event

2 posts, 0 answers
  1. TafnitDev
    TafnitDev avatar
    1 posts
    Member since:
    Jul 2013

    Posted 07 Aug Link to this post

    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",

    function Calc(e){
        if (!(IsValid(e.value)))
    }   ////////////////////////////////////////////////Here it calls to:trigger: function (eventName, e) which written above

    Is there some any way to do it?



  2. Misho
    Misho avatar
    126 posts

    Posted 09 Aug Link to this post


    We have created the following demo that is showing how to use Kendo slider API:
    You can use the following sample as a reference:

    I hope that helps.

    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
Back to Top