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

Combobox datasource refresh

2 Answers 178 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 04 May 2020, 09:51 AM

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 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 04 May 2020, 01:55 PM

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.
0
Dave
Top achievements
Rank 1
answered on 04 May 2020, 03:09 PM
Thanks Stefan, that helps a lot.
Tags
General Discussions
Asked by
Dave
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Dave
Top achievements
Rank 1
Share this question
or