Skip to main content

Bug Tracker

Side navigation

#2197 closed bug (fixed)

Opened January 20, 2008 11:30AM UTC

Closed February 12, 2008 02:37PM UTC

jqueryUI Slider plugin - Multiple handle BUG

Reported by: alexo Owned by: paul
Priority: major Milestone: 1.2.3
Component: ui Version: 1.2.2
Keywords: jquery ui plugin slider Cc: alex.objelean@gmail.com
Blocked by: Blocking:
Description

I'm using the demo code of the slider jquery-UI plugin to reproduce the bug. Below is a markup for a slider with multiple handle.

<div id='example3' class='ui-slider-2' style="margin: 40px;">
  <div class='ui-slider-handle'></div>
  <div class='ui-slider-handle' style="left: 188px;"></div>
</div>
<span id="slider-min"></span>
<span id="slider-max"></span>

Here the slider is constructed.

	$('#example3').slider({
          minValue: 0,
          maxValue: 100,
          slide: function(e,ui) {
	    $("#slider-min").text( ui.values[0] );
	    $("#slider-max").text( ui.values[1] );
	  }
        });

When the handler is moved, the span values are updated. The problem is that the second handler have the wrong value (0 instead of maxValue) when the first handler is moved for the first time.

Thank you!

Regards,

Alex Objelean.

Attachments (0)
Change History (2)

Changed January 23, 2008 09:42AM UTC by alexo comment:1

The problem seems to be the initialization of the curValue property in prepareCallbackObj function.

original:

var func = function() {
        var retVal = [];
        for(var i=0;i<cur.interactions.length;i++) {
          retVal.push((cur.interactions[i].curValue || 0)+self.options.minValue);
        }
        return retVal;
      };

Here is my quick&dirty hack for this situation:

prepareCallbackObj: function(self,m) {
      var cur = this;
      var func = function() {
        var retVal = [];
        for(var i=0;i<cur.interactions.length;i++) {
          //myHack
          (i == 1 && cur.interactions[i].curValue == null)
             ? retVal.push(cur.interactions[i].curValue || self.options.maxValue)
             : retVal.push((cur.interactions[i].curValue || 0)+self.options.minValue);
        }
        return retVal;
      };

This is not quite a bug, but it proves that the slider plugin lacks startValues option for multiple handle slider.

Thank you!

Regards,

Alex Objelean

Changed February 12, 2008 02:37PM UTC by paul comment:2

resolution: → fixed
status: newclosed

Hi, this is fixed in the new version of slider, which works quite different. To get values for handles, you must call $(el).slider('value', handleIndex) to get the value. Good luck!