Opened 12 years ago

Closed 10 years ago

Last modified 10 years ago

#7477 closed bug (fixed)

Setting min/max options does not update view

Reported by: maenu Owned by: petersendidit
Priority: minor Milestone: 1.9.1
Component: ui.slider Version: 1.8.13
Keywords: Cc:
Blocked by: Blocking:

Description

If you change the min or max options, the visual state of the slider does not get updated, but it should.

Example:

$("#slider").slider({
    range: true,
    min: 0,
    max: 3,
    values: [1, 2]
})
...
$("#slider").slider("option", "min", 1); // the bar still looks like -|--|-
...
var values = $("#slider").slider("option", "values");
$("#slider").slider("option", "values", values); // this is an ugly workaround, but triggers the change event

I'd propose either to catch that in _setOption and handle as setting the values, but not trigger the change event - since only the min/max changed, and not the values - or add a refresh method like the button has one.

Change History (8)

comment:1 in reply to:  description Changed 12 years ago by rdworth

Replying to maenu:

I'd propose either to catch that in _setOption and handle as setting the values, but not trigger the change event - since only the min/max changed, and not the values - or add a refresh method like the button has one.

Triggering change in any case would be safest as the value might change as the result of the min/max change. This would also be consistent with the design of the change event. From specs on http://wiki.jqueryui.com/Slider "triggers when the slider has stopped moving and has a new value (even if same as previous value)"

comment:2 Changed 12 years ago by Scott González

I'm inclined to say that the behavior for the change event should be modified. We have a tendency to not trigger change events if values don't actually change (at least in newer widgets). We should probably be consistent here and modify this for 1.9.

comment:3 Changed 10 years ago by Scott González

Milestone: 1.9.01.11.0

comment:4 Changed 10 years ago by tj.vantoll

Status: newopen

This is still relevant in 1.9. Here's a fiddle showing the problem described http://jsfiddle.net/tj_vantoll/pgKfb/.

comment:5 Changed 10 years ago by petersendidit

Owner: set to petersendidit
Status: openassigned

comment:6 Changed 10 years ago by petersendidit

comment:7 Changed 10 years ago by David Petersen

Resolution: fixed
Status: assignedclosed

Slider: Update UI when min or max option changes. Fixes #7477 - Setting min/max options does not update view.

Changeset: f37008eeb11eb12571cb65b1010a7e5d367064ac

comment:8 Changed 10 years ago by Scott González

Milestone: 1.11.01.9.1
Note: See TracTickets for help on using tickets.