Opened 12 years ago

Closed 12 years ago

Last modified 8 years ago

#4668 closed defect (worksforme)

Programmatic slider does not work correctly

Reported by: guest Owned by: Douglas Hays
Priority: high Milestone: 1.0
Component: Dijit - Form Version: 0.9
Keywords: Cc: jayant.b.sai@…
Blocked By: Blocking:

Description

I have already reported this in a forum posting (http://dojotoolkit.org/forum/dijit-dijit-0-9/dijit-support/programatic-vertical-slider-creation).

I am using 0.9.0 final. When a slider (I tried vertical only), is created through code, some features work and some don't.

What works:

  • Displays correctly (didn't try labels).
  • Clicking on individual values on slider fires onChange event.

What doesn't work:

  • onChange event not fired when using +/- buttons.
  • Unable to drag control button to change value.
  • Mouse wheel moves control button up/down, but does not fire onChange events.

Change History (6)

comment:1 Changed 12 years ago by Adam Peller

Owner: set to Douglas Hays

comment:2 Changed 12 years ago by Adam Peller

Milestone: 1.0
severity: criticalmajor

comment:3 Changed 12 years ago by Douglas Hays

Resolution: worksforme
Status: newclosed

The following seems to work correctly using the current dijit trunk:

<input id="sliderinput"><br>
<div id="slider"></div>
<script>
dojo.addOnLoad(function(){
var _slider = new dijit.form.VerticalSlider({ name:"slider",
onChange:function(){dojo.byId('sliderinput').value=arguments[0]},
minimum:0, maximum:10, discreteValues:11, style:"height:400px;"}, "slider");
});
</script>

In 0.9 final, the arrow keys do not fire onChange events until an onBlur event is received by the widget, unless you specify intermediateChanges: true
In 1.0, the arrow keys fire onChange independently of this boolean attribute.

Also, make sure that programmatic widget creation is inside a dojo.addOnLoad call since require calls are asynchronous.

comment:4 Changed 12 years ago by guest

I am currently still using 0.9 final. Creating the slider programmatically has the issues I listed originally. With the following changes, the +/- buttons and the mouse wheel work. Can someone please validate these changes?

_bumpValue: function(signedChange){ ...; this.setValue(value); }

to

_bumpValue: function(signedChange, priorityChange) { ...; this.setValue(value, priorityChange); }

Also

increment/decrement: function(...) { _bumpValue(..., true); }

comment:5 Changed 12 years ago by guest

Sorry for another post. Setting slider.intermediateChanges = true fixed my issues. I don't need the above changes.

thanks Jayant

comment:6 Changed 8 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.