Grid-related field

Hello everyone

I have a grid where I return a List that contains the data from the database and it contains the relationships, using the standard Blazor Grid the system shows the related data using the Syncfusion grid gives an error.

Json Returned

[{"modeloVeiculoId":"4e95fdbc-0695-4dcb-a029-6f8e60988ff6","fabricanteId":"94d79434-27f2-4878-885b-1243301b076c","descricao":"Meriva","fabricante":{"fabricanteId":"94d79434-27f2-4878-885b-1243301b076c","nome":"GM"},"veiculos":[]}]


Code

@page "/modelos"
@inject HttpClient  http

@if (categorias == null)
{
   

Carregando...

}
else if (categorias.Length == 0)
{
   

Não existem categorias cadastradas...

}
else
{
   
       
           
               
               
               
               
           
       
       
            @foreach (var categoria in categorias)
            {
               
                   
                   
                   
                   
               
            }
       
   
CategoriaDescriçãoEditaDeleta
@categoria.Fabricante.Nome@categoria.DescricaoEditar Deletar

   
           
               
                   
                        @**@
                       
                           
                           
                           
                               
                                   
                                   
                               
                           
                       
                   
               
           
       

}




   
Deseja realmente excluir este item ?




@code {

    ModeloVeiculo[] categorias { get; set; }

    Confirma confirma;

    protected override async Task OnInitializedAsync()
    {
        await CarregaCategorias();
    }

    async Task CarregaCategorias()
    {
        categorias = await http.GetJsonAsync("/api/modeloveiculos");
    }

    int codigoCategoria;

    void DeletarCategoria(Guid categoriaId)
    {
        confirma.Exibir();
        //    codigoCategoria = categoriaId;
    }

    async Task DeletaConfirma()
    {
        await http.DeleteAsync($"api/categoria/{codigoCategoria}");
        confirma.Ocultar();
        await CarregaCategorias();
    }

    void CancelaConfirma()
    {
        confirma.Ocultar();
    }
}


Attachment: error_ae43df7f.rar

3 Replies

RN Rahul Narayanasamy Syncfusion Team April 8, 2020 11:03 AM UTC

Hi Ulisses, 

Greetings from Syncfusion. 

Query: Grid-related field 

We have validated your query with the provided information and we suspect that you have facing the problem while rendering the fields in the Grid. Here, we have prepared a sample based on your data and it works fine without any errors. Find the below sample for your reference. 


 


If you are still facing the problem or we misunderstood your requirement, then could you please share more information(video demo, exact replication procedure) regrading your requirement. It will be helpful to validate and provide a better solution. 

Regards, 
Rahul 



UC Ulisses Correia de Araujo Neto April 8, 2020 01:40 PM UTC

Hi.

That's right, thank you very much for the support..


Ulisses


RN Rahul Narayanasamy Syncfusion Team April 9, 2020 04:28 AM UTC

Hi Ulisses, 

Thanks for the update. 

Please get back to us if you need further assistance. 

Regards, 
Rahul 


Loader.
Up arrow icon