Hi,
I'm trying to display related data in DataGrid. How do I do that?
So far I have this code, but the data does not get loaded into the DataGrid:
public asyncTaskOnPostDataSourceAsync([FromBody]DataManagerRequest dm)
{
varPlt=await _context.Paleta.Include(p => p.Dobavnica).AsNoTracking().ToListAsync();
IEnumerableDataSource=await _context.Paleta
.Include(p => p.Dobavnica)
.ThenInclude(p => p.Dobavitelj)
.AsNoTracking()
.ToListAsync();
DataOperations operation =newDataOperations();
if(dm.Search!=null&& dm.Search.Count>0)
{
DataSource= operation.PerformSearching(DataSource, dm.Search);//Search
}
if(dm.Sorted!=null&& dm.Sorted.Count>0)//Sorting
{
DataSource= operation.PerformSorting(DataSource, dm.Sorted);
}
if(dm.Where!=null&& dm.Where.Count>0)//Filtering
{
DataSource= operation.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator);
}
int count =DataSource.Cast().Count();
if(dm.Skip!=0)
{
DataSource= operation.PerformSkip(DataSource, dm.Skip);//Paging
}
if(dm.Take!=0)
{
DataSource= operation.PerformTake(DataSource, dm.Take);
}
return dm.RequiresCounts?newJsonResult(new{ result =DataSource, count = count }):newJsonResult(DataSource);
}
If I comment out:
.Include(p => p.Dobavnica).ThenInclude(p => p.Dobavitelj)
Then the data are loaded to the DataGrid.
Attachment: Palete_ab225d54.zip