We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Prefill dropdown List with template

Thread ID:

Created:

Updated:

Platform:

Replies:

144639 May 15,2019 02:26 PM UTC May 21,2019 07:18 AM UTC React - EJ 2 1
loading
Tags: DropDownList
TOKO FIDELE
Asked On May 15, 2019 02:29 PM UTC

Good evening. I'm currently using the DropDownListComponent component with the ItemTemplate and ValueTemplate templates. however, I change the value of my component when loading the page in the componentDidmount lifecycle via a via a setState. the problem is that the value is not taken into account and when the popup opens the item list is invisible..

By adding the value property in the component and modifying its value I have this momentum. I left your example at 

https://ej2.syncfusion.com/react/demos/#/material/drop-down-list/template 



Thanks in advance and regards,



Prince Oliver [Syncfusion]
Replied On May 21, 2019 07:18 AM UTC

Hello Toko, 
 
Thank you for contacting us. 
 
componentWillMount() is executed before the component rendering but whereas componentDidMount() is executed once the component has been rendered. When we change the value of the state, then we will be re-rendering in componenDidMount. It takes some time to reflect in the DOM tree. So, we suggest you use componentWillMount for updating the value property. Kindly refer to the following link for the sample 


Let us know if you need any further assistance on this. 

Regards, 
Prince 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon