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

Use the list instead of the URL in hosted core blazor

Before

<GridColumn Field=@nameof(Allergies.AllergyCategoryId) HeaderText="AllergyCategoryId" TextAlign="@TextAlign.Center" ValidationRules="@(new { required= true  })" ForeignKeyField="Id" ForeignKeyValue="Name"
                        DataSource="@(new Syncfusion.EJ2.Blazor.DataManager(){ Url = "api/AllergyCategories/GetNameId", Adaptor= Syncfusion.EJ2.Blazor.Adaptors.WebApiAdaptor })"></GridColumn>
 
after-----------------------------------------------------------------------------------------------------------------

<GridColumn Field=@nameof(Allergies.AllergyCategoryId) HeaderText="AllergyCategoryId" TextAlign="@TextAlign.Center" ValidationRules="@(new { required= true  })" ForeignKeyField="Id" ForeignKeyValue="Name"
                        DataSource="AllergyCategoriesList"></GridColumn>
code
{
 protected override async Task OnInitAsync()
    {

        
        AllergyCategoriesList = await http.GetJsonAsync<Allergies[]>("api/AllergyCategories");
}

7 Replies

VN Vignesh Natarajan Syncfusion Team July 30, 2019 04:13 PM UTC

Hi Edi Torabi,  

Thanks for your suggestion. 
 
Query: “Use the list instead of the url in blazor hosted sample” 

Case1: “While using DataManager (WebAPI Adaptor)” 
 
If we bind the column dataSource using WebAPI adaptor, post will be sent to server for each request or during a edit action. So new dataSource will be fetched from the server for each time.  
 
Case2: “While binding a data in form of list” 
 
We can bind the column dataSource using your suggested method (i.e) GetJSONAsync() of Blazor. While binding dataSource using this method, data will bound in form of list of objects. (Local data). So post will not be sent for each request. Initially requested list be bounded to column dataSource.    

If we need to fetch new data from server for each request, we suggest you to use WebAPIAdaptor, or if you do not want to fetch the data from server for each action, you can bind the dataSource using getJsonAsync() to fetch data from WebAPI service. 

Above explained methods can be used to bind dataSource to grid column 

Please get back to us if you have any queries.   

Regards, 
Vignesh Natarajan. 



ET ebi torabi July 30, 2019 08:51 PM UTC

 but data form a list does not bound
DataSource="AllergyCategoriesList"



VN Vignesh Natarajan Syncfusion Team July 31, 2019 03:44 PM UTC

Hi Ebi Torabi, 

Sorry for the inconvenience caused.  

We have validated the reported query by preparing a sample and we are able to reproduce it our end too. We are validating your query further and update you the details on August 1st 2019.    

Regards, 
Vignesh Natarajan. 



ET ebi torabi August 2, 2019 08:24 PM UTC

       
       
       
           
           

           



          <GridColumn Field=@nameof(Allergies.AllergyCategoryId) HeaderText="AllergyCategoryId"  ForeignKeyField="AllergyCategoryId" ForeignKeyValue="AllergyCategoryName" DataSource="@(new Syncfusion
        .EJ2.Blazor.DataManager(){ Url = "api/AllergyCategories", Adaptor= Adaptors.WebApiAdaptor })">

           

       



Both of the above do not work in version 17.2.0.40

If possible use an example template like the following code(ForeignKey)( hosted core blazor)

<EditTemplate>
                <EjsDropDownList Value="@((context as Order).CustomerID)" DataSource="@Orders">
                    <DropDownListFieldSettings Value="CustomerID"></AutoCompleteFieldSettings>
                </EjsDropDownList
></EditTemplate>



RN Rahul Narayanasamy Syncfusion Team August 7, 2019 06:26 AM UTC

Hi Ebi Torabi, 
  
Thanks for your patience. 
  
Query: Use the list instead of the url in blazor hosted sample 
  
We have checked reported problem and we have logged “Column's dataSource is not updated when using await GetJsonAsync method” as a bug. Thank you for taking the time to report this issue and helping us improve our product. The fix for this issue will be included in our upcoming NuGet release which will be expected to be rolled out on August 19, 2019. 
  
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.  
  
  
Query: foreign key datasource provided in column level is not working 
  
We have checked reported problem and we have logged “Column's dataSource provided as WebAPI Adpator is converted to BlazorAdaptor during initial rendering” as a bug. Thank you for taking the time to report this issue and helping us improve our product. The fix for this issue will be included in our upcoming NuGet release which will be expected to be rolled out on August 19, 2019. Until then we appreciate your patience. 
  
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.  
  
  
Query: If possible use an example template like the following code(ForeignKey)( hosted core blazor) 
  
Based on your request, we have tried to prepare the sample. Due to above reported problem, currently it is not possible to achieve this requirement. Once the above reported problems are fixed, we will get back to you with the sample. 
  
Until then we appreciate your patience. 
  
Regards, 
Rahul 



ET ebi torabi August 7, 2019 12:41 PM UTC

Hi Rahul . Thank you very much for your reply.


VN Vignesh Natarajan Syncfusion Team October 11, 2019 09:54 AM UTC

Hi Ebi Torabi,  
 
We are glad to inform that our latest Nuget package (17.3.0.17-beta) has been successfully rolled out. In this release we have included the fix for the issue “Column's dataSource is not updated when using await GetJsonAsync method”. Please find the latest Nuget package from below   
 
 
 
Also ensure that you have referred the latest version script and css as below  
 
<link rel='nofollow' href="https://cdn.syncfusion.com/ej2/17.3.17/fabric.css" rel="stylesheet" /> 
    <script src="https://cdn.syncfusion.com/ej2/17.3.17/dist/ej2.min.js"></script>   
 
For your convenience we have prepared a sample to bind the dataSource to Grid and Grid Column using GetJsonAsync method.  
 
 
Please get back to us if you have further queries. 
 
Regards, 
Vignesh Natarajan. 
 


Loader.
Live Chat Icon For mobile
Up arrow icon