Slider Inconsistencies

For some strange reason, clicking the segments on the bottom of the slider works correctly, but sliding the slider from point to point does not update the value of the slider consistantly, it seems to be delayed (it displays the previous value, not the current value.)

It’s acting like sliding it doesn’t trigger the on-change event when it should actually fire.

Clicking The Segments:
11-29-22ef92739d-3186-4199-a320-13da56d00244

Sliding it:
11-29-22d9e3a2f0-b458-491b-836c-f055cd23939a

Any ideas?

Hello @Michael_Kadron

I don’t quite understand the problem. And I don’t understand from the screenshots what is working wrong. Can you record a video and demonstrate what is not working correctly?

Regards,
Inna

@Inna_Shkolnaya
Notice that when the slider is slid from point-to-point that the value below the slider is not the same as the value of the slider that’s displayed in the slider’s value bubble.

On the other hand, when the segments are clicked, the value of the slider matches the value in the bubble of the slider.

Does that make sense?

@Michael_Kadron

Take a look at the video, everything seems to be displayed correctly Monosnap

Regards,
Inna

@Inna_Shkolnaya

You’re looking at the wrong number.

I’m not talking about the number in the bubble, look below the slider, this value displayed is the value retreived from the control.

Notice under the “Clicking The Segments” header, the values are correct – the number in the bubble matches the number displayed below the control.

Now notice under the “Sliding It” header, the value below the control clearly says “Eight”, while the bubble on the control says “9”.

Like I said previously, it’s like the on-change event isn’t being fired when it should when the slider is slid from side-to-side.

As you can see from this logic, the letter value displayed should match the number in the bubble:

I suggest adding some “print” statements into your logic to debug this further. If your logic shows “Eight” while the slider has “9” selected, it means the “Content Logic” was not triggered. The triggering of that logic would occur when the underlying data model changes. It changes when you update data in it.

@mark-piller
Hey Mark,

That’s exactly my point.

Why wouldn’t sliding it cause the exact same events as clicking on the individual segments?

It displays properly when the segments are clicked – but not when the slider is dragged???

Seems like a bug to me :slight_smile:

Mike

That’s exactly my point.

Why wouldn’t sliding it cause the exact same events as clicking on the individual segments?

It displays properly when the segments are clicked – but not when the slider is dragged???

Seems like a bug to me :slight_smile:

Mike

From “Mark Piller via Backendless Support” <support-forum@backendlessmail.com>
To “Michael Kadron” <mike@hyperpixels.net>
Date 11/29/2022 3:02:39 PM
Subject [Backendless Support] [UI Builder] Slider Inconsistencies

Yeah, it seems like a bug… in your codeless logic :wink:
Works for me as expected. Take a look
https://www.backendless.us/api/files/ui-builder/containers/support/index.html?page=slider

Hey @mark-piller,
My codeless logic is displayed above and is extremely simple.

The logic above is attached to the content logic on a paragraph control.
Is your logic in the on-change event of the slider?

Mike

Hi Mike,

My logic consists of 2 parts:

  1. The slider uses data binding to put its currently selected value into Page Data:

  2. The text label has data binding to logic (via the Content Logic handler):

Here’s why it works in my case:
When the slider changes (dragging or clicking) - it updates its data model. That update triggers all other content handlers that use the same data model, including Content Logic of the text label. As a result, my content logic always has the most current value of the slider.

Here’s why it doesn’t always work for you:
Your Content Logic goes directly into the component to get its value. As I wrote earlier, the Content Logic is triggered when the underlying model changes, in your case, there is no explicit or implicit change event of the data model.

I recommend reading the following sections of the UI Builder doc:
https://backendless.com/docs/uibuilder/ui_data_binding.html
https://backendless.com/docs/uibuilder/ui_rendering.html

Regards,
Mark

@mark-piller

I’ve read them, thanks.

One thing that I notice is that when clicking on the segments, only one event is triggered.
When sliding the slider, about 46 events are triggered in between the segments.

So answer this: Why does it work correctly when clicking on the segments and not work correctly when dragging the control? (Which was my original question :slight_smile:)

Thank you Mark.
40 year programming habits of reading a control’s value directly are hard to break! :slight_smile:

An answer to this question would be in the data binding mappings you have in the app. The rule of thumb is - any handler (such as Content Logic) is invoked when the underlying data model changes. This is the reason why in my demo I channel slider changes through the data model. The reason why your content handler is not triggered is that the data model is not updated.

Regards,
Mark