google-code-export / wiquery

Automatically exported from code.google.com/p/wiquery
MIT License
1 stars 1 forks source link

"Delayed" values when using AjaxSlider with range=true and AjaxSlideEvent #205

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When using the AjaxSlider with a range together with an AjaxSlideEvent, the 
values get "delayed", meaning that if I for example move the left handle from 0 
to 1, I will get an Ajax event where values[0] will return 0 (instead of 1, 
which it should). If i then move the right handle for example from 10 to 9, 
values[1] will show 10 (and not 9, which it should), but values[0] now shows 1.

Code to reproduce the problem:

AjaxSlider slider = new AjaxSlider("slider", 0, 10);
slider.setRange(new SliderRange(true));
ArrayItemOptions<IntegerItemOptions> values = new 

slider.setAjaxSlideEvent(new AjaxSlider.ISliderAjaxEvent() {
            public void onEvent(AjaxRequestTarget target, AjaxSlider slider, int value, int[] values) {
  System.out.println(values[0]);
  System.out.println(values[1]);
            }
        });

The reason for this bug seems to be the composition of the "slide" javascript 
function, where the value of "sliderValues" is set to the variable of "values", 
which is earlier assigned the value of $(this).slider('values'). The "values" 
variable seems unnecessary and it seems to work to just assign the 
"sliderValues" parameter the value of "ui.values", in the same way as the 
"sliderValue" parameter is assigned the value of "ui.value".

I provide my fixed versions of Slider.java and AjaxSlider.java.

I'm using wiQuery 1.2.4 on Windows 7.

Original issue reported on code.google.com by daniel.a...@gmail.com on 5 Sep 2011 at 11:11

Attachments:

GoogleCodeExporter commented 9 years ago
The third line of code (ArrayItemOptions...) should not be there, seems I 
failed to delete it before submitting the issue, sorry.

Original comment by daniel.a...@gmail.com on 5 Sep 2011 at 11:14

GoogleCodeExporter commented 9 years ago
Can you provide patch files?

Regards,

Ernesto

Original comment by reier...@gmail.com on 6 Sep 2011 at 7:33

GoogleCodeExporter commented 9 years ago
Sure, I hope this will do!

Original comment by daniel.a...@gmail.com on 6 Sep 2011 at 9:06

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by hielke.hoeve on 12 Sep 2011 at 8:29