How can I monitor the change of the dropdown position?

1 Answer 43 Views
DropDownList Popup
Nurik
Top achievements
Rank 2
Iron
Iron
Nurik asked on 07 Nov 2024, 04:24 AM
When I use dropdown and style border of popup, border top of popup is transparent and dropdown's bottom border transparent too. How can i change border of dropdown and popyp when popup change his position from bottom to top and opposite when I scroll content. Can I monitor change of popup of dropdown?

1 Answer, 1 is accepted

Sort by
1
Accepted
Yanko
Telerik team
answered on 08 Nov 2024, 01:34 PM

Hi, Nurik,

Yes, you can monitor the change of the popup position through the `onPosition` event. To implement the popup borders as described you can use the `onPosition` property of the `popupSettings` to determine whether the displayed border should be on the bottom or the top. The `onPosition` event has a property `flipped` that can be stored in a state and determine the border:

const [popupBorder, setPopupBorder] = React.useState();
  const handlePosition = (e) => {
    e.flipped ? setPopupBorder('Top') : setPopupBorder('Bottom');
  };
...
<DropDownList ... popupSettings={{ onPosition: handlePosition, style: { borderLeft: 'solid 1px red', borderRight: 'solid 1px red', [`border${popupBorder}`]: 'solid 1px red', width: '300px', }, }}
I prepared an example that showcases the above approach:

Regards,
Yanko
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Nurik
Top achievements
Rank 2
Iron
Iron
commented on 11 Nov 2024, 04:18 AM

Thank you, I fix my problem wtih your example.
Yanko
Telerik team
commented on 11 Nov 2024, 09:47 AM

I am glad to hear my example helped you in resolving the matter.
Tags
DropDownList Popup
Asked by
Nurik
Top achievements
Rank 2
Iron
Iron
Answers by
Yanko
Telerik team
Share this question
or