cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 - How to use custom value in Slider control?

former_member198924
Participant

Hi All,

I need to show the string values in sap.m.slider control. Intead of number value need to display string value.

Example: [Day 1, Day2, Day 3]

boghyon
Product and Topic Expert
Product and Topic Expert
0 Kudos

Did the sample below help? Please let us know and kindly close this question if the issue is resolved.

Accepted Solutions (0)

Answers (2)

Answers (2)

boghyon
Product and Topic Expert
Product and Topic Expert
0 Kudos

Here is a sample of a Slider displaying Day n: https://embed.plnkr.co/Wc1kLwunLoug2Rf5

The Slider control has a customTooltips aggregation which awaits one (or two in case of RangeSlider) instances of extended sap.m.SliderTooltipBase (api).

Although the SliderTooltipBase is an abstract module, it comes with a corresponding SliderTooltipBaseRenderer so that the tooltip developer just needs to overwrite "renderTooltipContent" (source). The content will be then responsive since its container has the CSS value display: flex.

jorge_cabanas
Participant
0 Kudos

Right! but notice that this property on mobile devices doesn't work as good as expected due to the screen touch event. No problems detected on desktop. It would be dependent of the application target.

Kind regards,
Jorge

boghyon
Product and Topic Expert
Product and Topic Expert
0 Kudos

jorge_cabanas Hi, not sure what you mean by "doesn't work as good as expected". What is the expected result? I just tested the sample on mobile and it works pretty well there.

jorge_cabanas
Participant
0 Kudos

boghyon.hoffmann Hi, when you press the slider (not tap), and slide it to the right (for example) some tooltips are not displayed.
I talk from self-experience,if you say that for you it's working, I would have a look at it again just in case.. Thanks for the feedback

jorge_cabanas
Participant
0 Kudos

boghyon.hoffmann Ah, by the way I meant deployed in mobile device not mobile simulation from desktop in WEB IDE or Chrome. Thanks for the feedback

boghyon
Product and Topic Expert
Product and Topic Expert
0 Kudos

jorge_cabanas Hmm, is the behavior reproducible here as well? https://openui5.hana.ondemand.com/test-resources/sap/m/SliderWithCustomElements.html

I was testing with a real device too, Android as well as iOS, but wasn't able reproduce the described issue.

jorge_cabanas
Participant
0 Kudos

Hi Durai,

According to the official documentation: "A sap.m.Slider control represents a numerical range and a handle".
So there is no easy way to implement this as string and probably if a way exists, would be tricky and not graceful.

Seeing that your requirement is select between a range of string values, I would strongly recommend you to use a comboBox control.
It would make it easier and faster.

Kind regards,
Jorge