DropDownTree lazy loading

1 Answer 326 Views
Wrappers for React
Andrei
Top achievements
Rank 1
Iron
Iron
Iron
Andrei asked on 07 Oct 2021, 11:48 AM | edited on 07 Oct 2021, 11:48 AM
Does KendoReact DropDownTree component has lazy loading feature so it fetch childrens on expand like it has in jquery version or how i do implement it myself?

1 Answer, 1 is accepted

Sort by
1
Accepted
Stefan
Telerik team
answered on 07 Oct 2021, 12:09 PM

Hello, Andrei,

Yes, this is a supported scenario in the KendoReact DropDownTree as well.

I made an example showcasing this:

https://stackblitz.com/edit/react-gr9hn2?file=app/main.jsx

Regards,
Stefan
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.

Andrei
Top achievements
Rank 1
Iron
Iron
Iron
commented on 07 Oct 2021, 12:40 PM

the example doesn't work it crashes when selecting an element
Stefan
Telerik team
commented on 07 Oct 2021, 01:11 PM

Apologies, it appears the last chanes were not saved:

https://stackblitz.com/edit/react-gr9hn2-mwtird?file=app/main.jsx
Andrei
Top achievements
Rank 1
Iron
Iron
Iron
commented on 07 Oct 2021, 01:47 PM

is it possible to remove the ability to select parent nodes, like if object has prop hasChildren: true then don't close dropdown and dont select?
Andrei
Top achievements
Rank 1
Iron
Iron
Iron
commented on 07 Oct 2021, 07:53 PM | edited

also for some reason in your example after selecting one element, next selected item is not higlighted
Stefan
Telerik team
commented on 08 Oct 2021, 09:55 AM

Both can be achieved using the controlled mode of the component where we can control the value and decide when to update it.

I updated example to showcase it:

https://stackblitz.com/edit/react-gr9hn2?file=app%2Fmain.jsx

Andrei
Top achievements
Rank 1
Iron
Iron
Iron
commented on 08 Oct 2021, 10:13 AM

example wasn't updated

Stefan
Telerik team
commented on 08 Oct 2021, 10:25 AM

Please check this one https://stackblitz.com/edit/react-gr9hn2-cwsgus?file=app%2Fmain.jsx

There are some issues with StackBlitz these days I will double check.

Andrei
Top achievements
Rank 1
Iron
Iron
Iron
commented on 12 Oct 2021, 10:45 AM | edited

the thing is that still when you click on parent node dropdown is being closed is it possible to make that when you click on parent node nothing happens(dropdown doesn't close and item isn't choosed)?
Stefan
Telerik team
commented on 12 Oct 2021, 11:36 AM

This is expected as the list is closed on click and not only when the value is changed.

The developer can control when the component is open/close with the opened property:

https://www.telerik.com/kendo-react-ui/components/dropdowns/api/DropDownTreeProps/#toc-opened

This will require using a custom logic on when the open it and when to close it.

For example, we can use the onOpen and onClose events. Then during the onClose events a custom logic has to be used to locate these cases where we will not close it:

https://www.telerik.com/kendo-react-ui/components/dropdowns/api/DropDownTreeProps/#toc-onopen

https://www.telerik.com/kendo-react-ui/components/dropdowns/api/DropDownTreeProps/#toc-onclose

Tags
Wrappers for React
Asked by
Andrei
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Stefan
Telerik team
Share this question
or