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

Databinding raises error Cannot read property 'pvtData' of undefined

Hi Support

I have a Blazor grid bound to a simple list generated by a search. It will not load and just hangs on the javascript error 

ej2.min.js:1 Uncaught TypeError: Cannot read property 'pvtData' of undefined
    at BlazorAdaptor.t.processResponse (ej2.min.js:1)
    at e.executeLocal (ej2.min.js:1)
    at ej2.min.js:1

The markup


    <div class="col-12">
        @if (AllMerchants.Count > 0)
        {
            <EjsGrid id="Grid" DataSource="@AllMerchants" AllowPaging="true" >
                <GridColumns>
                    <GridColumn Field=@nameof(BCProvider.Logo) Width="80"></GridColumn>
                    <GridColumn Field=@nameof(BCProvider.ProviderName) Width="276"></GridColumn>
                </GridColumns>
            </EjsGrid>
        }

    </div>

Any ideas on what could cause this? There are no null values in the returned data.

Thanks!!

5 Replies

RN Rahul Narayanasamy Syncfusion Team June 4, 2019 06:53 AM UTC

Hi Laurence, 
 
Greetings from Syncfusion. 
 
Query: I have a Blazor grid bound to a simple list generated by a search. It will not load and just hangs on the javascript error. Any ideas on what could cause this? There are no null values in the returned data. 
 
We have checked your reported issue and this can be solved in our latest release of the ASP.NET Core Blazor NuGet package. We suggest you upgrade to the latest NuGet package version 17.1.0.50-beta and if you use a CDN link in your application, please refer to the latest (17.1.49) CDN version. 

 

 
We have prepared a sample based on your requirements. Please find the below code snippet and sample link for your reference. 
 
[code snippet] 
@page "/" 
@using Blazorgrid 
@using WebApplication11 
@using Syncfusion.EJ2.RazorComponents.Grids 
 
<div> 
    <EjsGrid id="Grid" DataSource="@gridData" AllowPaging="true"> 
        <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> 
            <GridColumn Field=@nameof(OrdersDetails.OrderDate) HeaderText=" Order Date" Format="yMd" Type="date" EditType="datepickeredit" TextAlign="@TextAlign.Right" Width="130"></GridColumn> 
            <GridColumn Field=@nameof(OrdersDetails.Freight) HeaderText="Freight" Format="C2" EditType="numericedit" TextAlign="@TextAlign.Right" Width="120"></GridColumn> 
            <GridColumn Field=@nameof(OrdersDetails.ShipCountry) HeaderText="Ship Country" EditType="dropdownedit" Width="150"></GridColumn> 
        </GridColumns> 
    </EjsGrid> 
</div> 
 
@functions {     
    public object gridData { get; set; } 
    protected override void OnInit() 
    { 
        gridData = OrdersDetails.GetAllRecords(); 
    } 
 
} 
 
 
Note: Run the sample after clearing the cache in the browser. 
 
 
Please get back to us if you need further assistance. 
 
Regards, 
Rahul 



LA Laurence June 4, 2019 02:51 PM UTC

Hi Rahul - thanks for the reply - the new script takes care of the pvtData but I still cannot bind. There are no null values in the data returned to the List<> I am binding to.

Please see attached file - seems there are a lot of NewtonSoft errors - I am on latest Nuget NewtonSoft.Json 12.02

<div class="row">
    <div class="col-12">
        <EjsGrid id="Grid" DataSource="@AllMerchants" AllowPaging="true" >
            <GridColumns>
                <GridColumn Field=@nameof(BCProvider.ProviderName) Width="276"></GridColumn>
            </GridColumns>
        </EjsGrid>
    </div>
</div>

@functions
{

    public List<BCProvider> AllMerchants { get; set; }

    protected override async Task OnInitAsync()
    {
        SearchMerchants = new List<BCProvider>();
        AllMerchants = new List<BCProvider>();
        AllMerchants = await MerchantService.GetAllMerchants(IndexedDBService);
    }

}


RN Rahul Narayanasamy Syncfusion Team June 5, 2019 12:35 PM UTC

Hi Laurence, 
 
Query: the new script takes care of the pvtData but I still cannot bind. There are no null values in the data returned to the List<> I am binding to. Please see attached file - seems there are a lot of NewtonSoft errors - I am on latest Nuget NewtonSoft.Json 12.02 
 
We have validated your query and checked the reported problem. It works fine at our end. We have prepared sample for your reference. Please find the sample in below link. 
 
 
If you have used client side application, then we suggest to add the following codes in application.csproj file(within PropertyGroup tag) if you have run client application. Please find the below code example for your reference. 
 
<PropertyGroup> 
    <TargetFramework>netstandard2.0</TargetFramework> 
    <OutputType>Exe</OutputType> 
   <BlazorLinkOnBuild>false</BlazorLinkOnBuild> 
</PropertyGroup> 
 
If you are still facing any difficulties, could you please share the below details it will be helpful to provide a better solution. 
 
  • Share full grid code example(both grid and class code example).
  • Please ensure whether you have used blazor server side.
  • Please share the sample if it is possible.
 
Regards, 
Rahul 



LA Laurence June 6, 2019 01:25 PM UTC

Thank you Rahul I will attempt to get it to work now


GS Gurupriyadharshini Sankaranarayanan Syncfusion Team June 7, 2019 08:01 AM UTC

Hi Laurence 
   
Thanks for your update. 
   
Please get back to us if you need further assistance.  
 
Regards, 
Gurupriyadharshini S. 


Loader.
Live Chat Icon For mobile
Up arrow icon