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

Refresh grid datasource (Blazor)

Thread ID:

Created:

Updated:

Platform:

Replies:

144795 May 23,2019 07:07 AM UTC May 27,2019 01:05 PM UTC Blazor 4
loading
Tags: Grid
Felix
Asked On May 23, 2019 07:07 AM UTC

Hi,

can you give me some advice on how to refresh the datasource of the grid in blazor?
I have the following code:

<EjsGrid ID="stample-grid" DataSrouce="@SelectedProduct?.Categories" AllowPaging="true">
    <GridSelectionSettings PersistSelection="true"></GridSelectionSettings>
    <GridColumns>
        <GridColumn Field="@nameof(Category.Name)" HeaderText="Name" />
        <GridColumn Field="@nameof(Category.Description)" HeaderText="Description" />
    </GridColumns>
</EjsGrid>

The property "Categories" contains product specific categories but of course only if a product is selected (see the ?-operator). But unfortenately the datasource never gets updated. What am I doing wrong here?

Best regards
Felix

Hariharan J V [Syncfusion]
Replied On May 23, 2019 03:27 PM UTC

Hi Felix, 
  
Thanks for contacting Syncfusion support. 
  
We have checked your query and we have found that you have mentioned the DataSource property with incorrectly. Also, We have prepared a simple sample in which DataSource can be binded to grid without any issue. Please refer the following code snippet and sample link for your reference. 
  
[Index.razor] 
<EjsGrid id="Grid" DataSource="@gridData" AllowPaging="true"> 
    <GridPageSettings PageSize="5"></GridPageSettings> 
    <GridSelectionSettings PersistSelection="true"></GridSelectionSettings> 
    <GridColumns> 
        <GridColumn Field=@nameof(OrdersDetails.OrderID) HeaderText="Order ID" IsPrimaryKey="true" TextAlign="@TextAlign.Right" Width="120"></GridColumn> 
        <GridColumn Field=@nameof(OrdersDetails.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn> 
        .  .  .  . 
    </GridColumns> 
</EjsGrid> 
  
  
@functions { 
    public object gridData { get; set; } 
    protected override void OnInit() 
    { 
        gridData = OrdersDetails.GetAllRecords(); 
    } 
} 
  
  
Please get back to us for further assistance. 
  
Regards, 
Hariharan 


Felix
Replied On May 24, 2019 06:49 AM UTC

Oh ... that was just a typo. But it's fine in my project. I can confirm that your sample project works flawlessly. I will now investigate why my project does not and I will contact you if I have further questions. Thank you for your help!

Felix
Replied On May 24, 2019 09:08 AM UTC

Okay, everything works now. I had the <EjsGrid> in a separate component. As a result, the events did not work properly.

I have another question regarding licensing. Is it correct that all Syncfusion components can be used for free and without restrictions by private developers through a community license? And how do I know that I have the appropriate license key?

Best regards
Felix

Thavasianand Sankaranarayanan [Syncfusion]
Replied On May 27, 2019 01:05 PM UTC

Hi Felix, 
 
Thanks for your update. 
 
Query 1: Okay, everything works now. I had the <EjsGrid> in a separate component. As a result, the events did not work properly.  
 
We have checked your query and tried to reproduce the issue, but it was unsuccessful. We have prepared a sample where we have used RowSelected event which works properly. We suggest you to use the latest nuget package (17.1.0.48-beta) version. Please refer the following code and sample link. 
 
[Index.razor] 
<EjsGrid id="Grid" DataSource="@gridData" AllowPaging="true" RowSelected="@rowselect"> 
    <GridPageSettings PageSize="5"></GridPageSettings> 
    <GridSelectionSettings PersistSelection="true"></GridSelectionSettings> 
    <GridColumns> 
        <GridColumn Field=@nameof(OrdersDetails.OrderID) HeaderText="Order ID" IsPrimaryKey="true" TextAlign="@TextAlign.Right" Width="120"></GridColumn> 
        .  .  .  . 
    </GridColumns> 
</EjsGrid> 
 
 
@functions { 
    public object gridData { get; set; } 
    protected override void OnInit() 
    { 
        gridData = OrdersDetails.GetAllRecords(); 
    } 
        public void rowselect(RowSelectEventArgs args) 
    { 
        System.Console.WriteLine(args.RowIndex); 
    } 
 
} 
 
 
 
Query 2: I have another question regarding licensing. Is it correct that all Syncfusion components can be used for free and without restrictions by private developers through a community license? And how do I know that I have the appropriate license key? 
 
We have checked and forwarded your query to sales team. We will update the further details as soon as possible. Also you can contact the sales team through this mail id: Sales@syncfusion.com  
 
Regards, 
Thavasianand S. 


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