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. Image for the cookie policy date
close icon

How to re-initialize dropdownlist's value

I have a report filter that has a dropdownlist and user can select a row from list.

It's possible that user clicks on "clear" button to delete all selected values in the filters, the problem that exists is this that we can not make the value of dropdown value to null as before the user has selected anything.

Please advice how we can achieve this.

Thanks in advance


1 Reply

AB Ashokkumar Balasubramanian Syncfusion Team September 3, 2019 10:54 AM UTC

Hi Afshin, 
 
Greetings from Syncfusion support. 
 
We have checked the reported requirement. We would like to let us know that, by default dropdown list value is null. When you clear the value using clear button then input element goes empty and dropdownlist value is null. If you need to set the dropdown list value is null by programmatically, then take the instance and set the value for value property is null as mentioned below. 
 
<DropDownListComponent id="country" ref={(dropdownlist) => 
    { this.listObj = dropdownlist; }} dataSource={this.searchData} filtering={this.onFiltering.bind(this)} filterBarPlaceholder='Search a country' allowFiltering={true} fields={this.fields} placeholder="Select a country" popupHeight="220px" showClearButton="true" created={this.onCreated.bind(this)} /> 
 
this.onCreated = (e) => { 
     this.listObj.value = null; 
} 
 
In the filters if you have typed some characters and using clear button to clear the values in inputs, all the search character will be cleared.  
 
 
If we misunderstood your query, please revert more details to us it will help to validate further. 
 
Regards, 
Ashokkumar B. 


Loader.
Live Chat Icon For mobile
Up arrow icon