Multiple Sliders Slide event

3 posts, 0 answers
  1. Angelo
    Angelo avatar
    32 posts
    Member since:
    Nov 2011

    Posted 04 Sep 2012 Link to this post

    I have multiple sliders on one page, meant to update a Radial Gauge using mathematical equations happening in the background as each slider is changed. All is working well.

    However, it's been requested that I use the "slide" event instead of "change" to be more visually appealing. I know how to use the "slide" event handler for a single slider, but now I need to use the values for multiple sliders upon each slider's "slide" event.

    The problem is that using options.value appears to be one value behind when using multiple sliders, as opposed to when it happens. How can I grab the current values of all sliders INCLUDING the value of the one that's currently being changed? I can only seem to do one or the other, instead of both types of values.

    This is what I'm currently using:
    function get_sum_prod_2(e) {
        arry_smpr = [0.285811679343038, 0.125446827004167, 0.216179632937688, 0.201202024564389, 0.211742022094242, 0.373720493554278, 0.148421270571020];
        x = 0;
        for(i = 0 ; i < 7 ; i++) {
            x += $("#sldr_" + (i + 1)).data("kendoSlider").options.value * arry_smpr[i];
        }
        console.log(x);
    }
  2. Dimo
    Admin
    Dimo avatar
    8331 posts

    Posted 05 Sep 2012 Link to this post

    Hello Angelo,

    If you correctly use the slide event's e.value argument, you will obtain the current value.

    Regards,
    Dimo
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Angelo
    Angelo avatar
    32 posts
    Member since:
    Nov 2011

    Posted 05 Sep 2012 Link to this post

    Thanks. I figured it out. For anyone needing the same functionality, this is what I used (had to add current slider ID to change function):
    function get_sum_prod(e, curr_id) {
        sum_prod = (e.value * arry_smpr[curr_id - 1]);
        for(i = 0 ; i < $("#divs_drvr .tile_sldr").length ; i++) {
            if(i != (curr_id - 1)) {
                sum_prod += $("#sldr_" + (i + 1)).data("kendoSlider").options.value * arry_smpr[i];
            }
        }
     
        $("#cont_drvr").data("kendoRadialGauge").value(sum_prod);
    }
Back to Top