Kendo React Grid with Drop Down list

4 posts, 0 answers
  1. Miriam
    Miriam avatar
    3 posts
    Member since:
    Jul 2020

    Posted 22 Sep 2020 Link to this post

    Hi.

    I have a Kendo React grid. data is coming from a fetch API. It works fine, but I have a drop down list that gets filled by another API.

    Where do I fetch that data? Does anyone have a working example?

     

    Thanks!!

  2. Stefan
    Admin
    Stefan avatar
    3034 posts

    Posted 23 Sep 2020 Link to this post

    Hello, Miriam,

    This will depend on the application setup.

    In general, we can recommend making the API request on the componentDidMount event (or hooks alternative) and setting the data in the state. Then using that data from the state in the DropDownList.

    The request can be made inside each cell when it is opened, but this will make many unnecessary requests unless each DropDownList will have unique data based on an ID or other information.

    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).

  3. Miriam
    Miriam avatar
    3 posts
    Member since:
    Jul 2020

    Posted 24 Sep 2020 in reply to Stefan Link to this post

    Thanks. not sure I understood. Do I fetch data in parent component (grid) or in child component (drop down list)?
  4. Stefan
    Admin
    Stefan avatar
    3034 posts

    Posted 24 Sep 2020 Link to this post

    Hello, Miriam,

    Both places are possible, these are the differences:

    1) Fetching the data in the Grid component and passing it to the child components - This is the recomended approach if the data in all DropDownList will be the same. This will make a single request and use the data in all DropDownList.

    2) Fetching the data in the DropDownList component - This is recomended only when the DropDownList will have different data based on Grid rows. The downside it that this will produce many requests, but if they will be different then it is required.

    The correct approach will depend on the application.

    Regards,
    Stefan
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Back to Top