This is a migrated thread and some comments may be shown as answers.

DropdownList popup auto height by content

4 Answers 1059 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sergey
Top achievements
Rank 1
Sergey asked on 18 Sep 2020, 07:42 AM
Are there any variants to set popup height by content ? As I see, for that, we can use popupSettings.height for that, but in this case I have to calculate height manually.

4 Answers, 1 is accepted

Sort by
1
Nikolay
Telerik team
answered on 18 Sep 2020, 11:50 AM

Hello,

By setting popupSettings.height to 'auto', the browser will calculate it for you. Here is an example - https://stackblitz.com/edit/react-xa5jqs?file=app/main.jsx.

Regards,
Nikolay
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

0
Sergey
Top achievements
Rank 1
answered on 18 Sep 2020, 12:23 PM

Still isn't what I'm looking for - I need something like maxHeight

I'm trying to build filtering and when It contains many elements,-  It should show scroll, otherwise should work like height auto.

Maybe smth like this
popupSettings.height = items.length > 5  ? '100' : 'auto' ?
Would It work properly 
0
Sergey
Top achievements
Rank 1
answered on 18 Sep 2020, 12:45 PM
No, this approach doesn't work.
0
Stefan
Telerik team
answered on 22 Sep 2020, 07:20 AM

Hello, Sergey,

Thank you for the clarification.

The height property actually sets max-height CSS rules instead of height:

This means, that setting it will show scrolling when there are many items and automatically remove it when there are less items.

Regards,
Stefan
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

Tags
General Discussions
Asked by
Sergey
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Sergey
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or