How to refresh SfDropDownList drop down contents when using odata v4 data adaptor

I want to add a refresh button in the footer of my SfDropDownList to allow the user to reload the contents of the drop down from the data source using odata v4 adaptor.

I don't know what function to call on the component or data manager to force a reload/refresh.

I included my component.

Using VS2022 and version 19.4.0.52



Attachment: Components_f4081416.zip

1 Reply

SP Sureshkumar P Syncfusion Team February 22, 2022 02:39 PM UTC

Mark, 
 
You can achieve your requirement by change the Query property value as like below code.  
 
Find the code example: 
 
<SfDropDownList TValue="string" TItem="orders" Placeholder="Select a Employee" Query="@Query"> 
    <SfDataManager Url="https://js.syncfusion.com/ejServices/Wcf/Northwind.svc/Orders/" Adaptor="Syncfusion.Blazor.Adaptors.ODataAdaptor" CrossDomain=true></SfDataManager> 
    <DropDownListFieldSettings Text="CustomerID" Value="CustomerID"></DropDownListFieldSettings> 
    <DropDownListTemplates TItem=orders> 
        <FooterTemplate> 
            <button @onclick="ButtonClick">Click to refresh</button> 
        </FooterTemplate> 
    </DropDownListTemplates> 
</SfDropDownList> 
 
@code { 
    public Query Query = new Query(); 
 
    void ButtonClick() 
    { 
Query = new Query().Take(5); 
    } 
 
    public class orders 
    { 
        public string CustomerID { get; set; } 
    } 
} 
 
 
Regards, 
Sureshkumar P 


Loader.
Up arrow icon