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

Dynamic data source binding on grid

Thread ID:

Created:

Updated:

Platform:

Replies:

151043 Jan 29,2020 04:04 AM UTC Jan 30,2020 05:18 AM UTC Blazor 1
loading
Tags: Grid
Raul
Asked On January 29, 2020 04:04 AM UTC

Hi, is ObservableCollection the only way to dynamically bind a datasource? I mean it seems like a step backwards from the way it used to work.

Vignesh Natarajan [Syncfusion]
Replied On January 30, 2020 05:18 AM UTC

Hi Raul,  
 
Thanks for contacting Syncfusion support.  
 
Query: “is ObservableCollection the only way to dynamically bind a datasource? I mean it seems like a step backwards from the way it used to work 
 
From your query, we suspect that you are facing issue while changing the datasource dynamically / externally in Grid. While using ObservableCollection changes done externally like Add, Delete, Update item will be reflected automatically in Grid without any external action.  
 
But if you are binding the datasource in form of IEnumerable collection, after the changing the datasource. You need to call Refresh() method of Grid to reflect the changes done externally. Because tracking items of IEnumerable for changes done externally is avoided for performance considerations. 
 
Refer the below code example.  
 
<EjsButton OnClick="Clik">Save</EjsButton> 
<EjsGrid @ref="GridInstance" AllowPaging="true" DataSource="@Orders" Toolbar="@(new List<string>() { "Cancel", "Update" })"> 
. . . . . . . . . 
</EjsGrid> 
 
@code{ 
    public static EjsGrid<Order> GridInstance { get; set; } 
    public void Clik() 
    {//call refresh method after changing the datasource externally 
        GridInstance.Refresh(); 
    } 
 
If above solution does not resolve your query, kindly get back to us with more details about your issue or requirement.  
 
Regards, 
Vignesh Natarajan. 


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