I am trying to use the DataGrid and I'm getting an error on binding. The error is:
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Unable to set property 'DataSource' on object of type 'IgniteUI.Blazor.Controls.DataGrid'. The error was: Blazor.platform.readInt64Field is not a function
The grid is a very simple grid defined:
<DataGrid Width="100%" Height="100%" AutoGenerateColumns="false" DataSource="HmpContractors"> <NumericColumn Field="Id" IsHidden="true" /> <TextColumn Field="Name" HeaderText="Name" /> </DataGrid>
Here is a sample of the JSON data it is trying to bind to:
"certifications": [ { "id": 1, "certificationName": "WCLA" } ], "policies": [], "notes": "Steve Skaglund - Co-owner with Jeff. Steve's cell number is 360.631.3728", "foresters": [ { "id": 10, "firstName": "Kris", "lastName": "McCall", "abbreviation": "KM", "phoneNumbers": [], "emails": [] } ] }, { "id": 2, "limS_VendorId": "3b E", "name": "3B Excavators, LLC", "address1": "PO Box 12126", "address2": null, "city": "Salem", "state": "OR", "postalCode": "97302", "certificationRequired": true, "phones": [ { "id": 3, "phoneNum": "5033643821", "phoneType": 3 }, { "id": 4, "phoneNum": "(503) 362-1733", "phoneType": 1 } ], "insuranceContacts": [], "ein": "35-2331517", "stateNum": null, "ubiNum": "0", "workersCompNum": "6JUB-0G19574-4-16", "lAndINum": "0", "active": true, "professions": [ { "id": 8, "professionName": "Misc." } ], "certifications": [], "policies": [], "notes": "", "foresters": [ { "id": 12, "firstName": "Mark", "lastName": "Vroman", "abbreviation": "SMV", "phoneNumbers": [], "emails": [] } ] },
Hello Kenneth,
This error usually occur when you don’t register the control module within razor files at the time the page is initialized . So did you register DataGridModule in your application like this:
protected override void OnInitialized() { base.OnInitialized(); DataGridModule.Register(IgniteUIBlazor); }
You can also refer to this online help document for detail explaination about how to set up blazor application:www.infragistics.com/.../general-getting-started.html
I registered the control module exactly as you have listed above.
public partial class Contractors { [Inject] public ILimsDataService limsDataService { get; set; } [Inject] public NavigationManager navManager { get; set; } [Inject] public IIgniteUIBlazor IgniteUIBlazor { get; set; } public List<HmpContractor> HmpContractors { get; set; } = new List<HmpContractor>(); protected override void OnInitialized() { base.OnInitialized(); DataGridModule.Register(IgniteUIBlazor); } protected override async Task OnInitializedAsync() { HmpContractors = (await limsDataService.GetAllActiveContractors()).ToList(); } protected void AddNewContractor() { navManager.NavigateTo("ContractorDetails"); } protected void EditContractor(int id) { navManager.NavigateTo($"ContractorDetails/{id}"); } }