Jak wyświetlić dane w MudDataGrid?

0

Dzień dobry,
napisałem program który wyświetla komponent o nazwie InformatorKontrahent.razor za pomocą:

await DialogService.ShowAsync<InformatorKontrahent>

wszystko działa super, oprócz tego że po wyświetleniu komponentu InformatorKontrahent powinien wczytać dane o kontrahencie
za pomocą:

ListOfOrders = await baza.GetListOfOrders();

do komponentu MudDataGrid, ale niestety tego nie robi :(

screenshot-20231228092206.png
Natomiast w konsoli za pomocą pętli foreach wszystko jest ok.

Oto najważniejsze elementy komponentu InformatorKontrahent

<MudDialogProvider />
<MudDialog IsVisible="Wyswietl" Style="width: 700px, height:700px" >
    <TitleContent>
      <MudDataGrid Items="@ListOfOrders">
          <Columns>
              <PropertyColumn Property="x => x.Kontrahent" Title="Kontahent" />
       
          </Columns>
      </MudDataGrid>
    </TitleContent>
        <DialogActions>
      <MudButton Color="@Color" Variant="Variant.Filled"  OnClick="PrzyciskAnuluj">OK</MudButton>
      </DialogActions>
  </MudDialog>
private async Task WczytajDane()
{
    ListOfOrders = await baza.GetListOfOrders();

foreach (var a in ListOfOrders)
    {

        Console.WriteLine(a.Kontrahent);
    }

     StateHasChanged();

}


protected override async Task OnInitializedAsync()
{
  await   WczytajDane();
 }
0
virusek391 napisał(a):

Dzień dobry,
napisałem program który wyświetla komponent o nazwie InformatorKontrahent.razor za pomocą:

await DialogService.ShowAsync<InformatorKontrahent>

wszystko działa super, oprócz tego że po wyświetleniu komponentu InformatorKontrahent powinien wczytać dane o kontrahencie
za pomocą:

ListOfOrders = await baza.GetListOfOrders();

do komponentu MudDataGrid, ale niestety tego nie robi :(

screenshot-20231228092206.png
Natomiast w konsoli za pomocą pętli foreach wszystko jest ok.

Oto najważniejsze elementy komponentu InformatorKontrahent

<MudDialogProvider />
<MudDialog IsVisible="Wyswietl" Style="width: 700px, height:700px" >
    <TitleContent>
      <MudDataGrid Items="@ListOfOrders">
          <Columns>
              <PropertyColumn Property="x => x.Kontrahent" Title="Kontahent" />
       
          </Columns>
      </MudDataGrid>
    </TitleContent>
        <DialogActions>
      <MudButton Color="@Color" Variant="Variant.Filled"  OnClick="PrzyciskAnuluj">OK</MudButton>
      </DialogActions>
  </MudDialog>
private async Task WczytajDane()
{
    ListOfOrders = await baza.GetListOfOrders();

foreach (var a in ListOfOrders)
    {

        Console.WriteLine(a.Kontrahent);
    }

     StateHasChanged();

}


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

@rjakubowski

Zrobiłem tak i nadal nic :(

     await InvokeAsync(async () =>
  {
      await DialogService.ShowAsync<InformatorKontrahent>("Confirm", parameters);
    });
0
virusek391 napisał(a):

Dzień dobry,
napisałem program który wyświetla komponent o nazwie InformatorKontrahent.razor za pomocą:

await DialogService.ShowAsync<InformatorKontrahent>

wszystko działa super, oprócz tego że po wyświetleniu komponentu InformatorKontrahent powinien wczytać dane o kontrahencie
za pomocą:

ListOfOrders = await baza.GetListOfOrders();

do komponentu MudDataGrid, ale niestety tego nie robi :(

screenshot-20231228092206.png
Natomiast w konsoli za pomocą pętli foreach wszystko jest ok.

Oto najważniejsze elementy komponentu InformatorKontrahent

<MudDialogProvider />
<MudDialog IsVisible="Wyswietl" Style="width: 700px, height:700px" >
    <TitleContent>
      <MudDataGrid Items="@ListOfOrders">
          <Columns>
              <PropertyColumn Property="x => x.Kontrahent" Title="Kontahent" />
       
          </Columns>
      </MudDataGrid>
    </TitleContent>
        <DialogActions>
      <MudButton Color="@Color" Variant="Variant.Filled"  OnClick="PrzyciskAnuluj">OK</MudButton>
      </DialogActions>
  </MudDialog>
private async Task WczytajDane()
{
    ListOfOrders = await baza.GetListOfOrders();

foreach (var a in ListOfOrders)
    {

        Console.WriteLine(a.Kontrahent);
    }

     StateHasChanged();

}


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

Rozwiązaniem mojego problemu było usunięcie MudDialog z komponentu InformatorKontrahent i pozostawienie całości w taki sposób:

 <MudDataGrid Items="@ListOfOrders">
          <Columns>
              <PropertyColumn Property="x => x.Kontrahent" Title="Kontahent" />
          </Columns>
      </MudDataGrid>

1 użytkowników online, w tym zalogowanych: 0, gości: 1