This topic contains 6 replies, has 2 voices, and was last updated by  Dimitar 9 years, 1 month ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • Too many event calls #71971

    srmark
    Participant

    Hello,
    I’m using input fields, that has onchange events attached to them, and when I add the slider widget to them, the onchange function already attached to them fires 5-10 times in a row each, why is this happening and how could I fix it?

    When I actually modify the input fields by hand, their onchange event only fires once, as intended.

    Thanks in advance for your help,
    Roland

    Too many event calls #71990

    Dimitar
    Participant

    Hello Roland,

    Please provide us with your source code or, better yet, a JSFiddle example which demonstrates the issue and we can test.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Too many event calls #72039

    srmark
    Participant

    Hi Dimitar,
    I fixed things at other parts of my code that caused additional event calls, but some still remains, that I can also solve with a workaround. In this fiddle the events fire twice per slider.

    When I first initialise the sliders without value, then add the onchange events, then I call the initialiser again with the value I want to load into the sliders then the onchange will fire 2 times per slider from the last initialiser calls, and my solution to this was to use only the jquery val() function on the sliders once they were initialised to set their values.

    Too many event calls #72040

    srmark
    Participant

    Edit to my previous post:
    At one slider in my code I cannot just use the val() function, because I wanted to create a slider to be able to pick from a big range, but still accurately at the low values. I mean the range would be from 5 to 600, but the slider has a limited width, so when dragging the thump you would not be able to pick 8 or 10 because the next value from 5 would be bigger than those. So I set up the slider according to the value, I it’s below 60 the slider range goes from 5 to 60, otherwise up to 600. So in my case I have to use a code similar to this, but here the events fire twice too, once for setting the max range, and once for setting the value, as I experienced.

    An option to set the slider to a non-linear range, such as giving an array to it with predefined values would be nice, but I didn’t find anything like it in the api reference.

    Too many event calls #72041

    Dimitar
    Participant

    Hello srmark,

    Please clarify why you do not set the required values of min and max at initialization, but re-set them afterwards. As for setting an array of initial values – this is supported, as shown by the following example: http://jsfiddle.net/jqwidgets/tUAyj/.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Too many event calls #72043

    srmark
    Participant

    Hi Dimitar,
    The input fields I have are in a big system, which is a HTML and flowchart editor UI, where I iterate over all tags through a class I gave to them when the system loads, and initialise them to be actual sliders, but at that point those sliders are hidden, and dont know any value to give to them. When I open the part of the UI where I use the sliders, I can select elements on the edited HTML page, read out their actual values from added HTML5 data attributes, and depending on the value, I set the range of the slider to fit the value, either 5-60, or 5-600.

    With the array I meant that I would like only one thumb on the slider, and when I drag it, it can get predefined numbers, for example 5, 10, 20, 50, 100, 200, 300, 600, and only these, so the slider would have only 8 steps, and the difference between each step would be different.

    Thanks for your replies,
    Roland

    Too many event calls #72061

    Dimitar
    Participant

    Hi Roland,

    I understand now. We will look into the issue of the unnecessary change event triggers. Please note, however, that these occur only when setting min/max dynamically. When dragging the thumb, change is triggered only once per pixel (or step if it is bigger) move.

    And unfortunately, setting an array of predefined values is not supported.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.