Combobox datasource refresh

3 posts, 1 answers
  1. Dave
    Dave avatar
    2 posts
    Member since:
    Feb 2014

    Posted 04 May 2020 Link to this post

    I have created a component which purely renders a kendoReact combobox that uses a datasource made by a SQL webservice (all self contained in the component). I then have this at the top of a form which will display data from the selected combobox item.

    My question is if i amend or add a new record the combobox does not know that the data has changed and so does not refresh it's datasource. what is the best way to acheive this?

    Many Thanks

     

  2. Answer
    Stefan
    Admin
    Stefan avatar
    3034 posts

    Posted 04 May 2020 Link to this post

    Hello, Dave,

    The ComboBox component receives its data via the data prop. If the ComboBox data has to be updated then the data prop that is bound to it has to be updated as well.

    This can be done by binding the value in the state of the component that renders the ComboBox.

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

    If the ComboBox does not know that the state is changed, we have to lift the state up in a parent component and update the ComboBox via props:

    https://reactjs.org/docs/lifting-state-up.html

    If additional assistance is needed, please share the source code of the component and the data source, as this will help us better understand the scenario.

    Regards,
    Stefan
    Progress Telerik

    Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
    Our thoughts here at Progress are with those affected by the outbreak.
  3. Dave
    Dave avatar
    2 posts
    Member since:
    Feb 2014

    Posted 04 May 2020 in reply to Stefan Link to this post

    Thanks Stefan, that helps a lot.
Back to Top