Datagrid empty when reading from UrlAdaptor
Hi,
This demo page show 'no records'. I read your recommendations in thread (https://www.syncfusion.com/forums/141644/empty-grid-with-urladaptor), but it does not work (maybe because I'm not using MVC?). I have also tried to change the names of the fields to camelCase manually, to no avail.
Please assist,
Johan
@using Syncfusion.Blazor
@using Syncfusion.Blazor.Data
@using Syncfusion.Blazor.Grids
@page "/"
<SfGrid TValue="SymbolData" ID="Grid" AllowPaging="true">
<SfDataManager Url="http://x4.trading:8888/symbols" Adaptor="Adaptors.UrlAdaptor"></SfDataManager>
<GridColumns>
<GridColumn Field=@nameof(SymbolData.symbol) TextAlign="TextAlign.Center" HeaderText="Symbol" Width="120"></GridColumn>
<GridColumn Field=@nameof(SymbolData.last) HeaderText="Last" Width="130"></GridColumn>
<GridColumn Field=@nameof(SymbolData.lastUpdate) HeaderText="Last Update" Width="120"></GridColumn>
</GridColumns>
</SfGrid>
@code{
public class SymbolData
{
public string symbol { get; set; }
public double bid { get; set; }
public double last { get; set; }
public double ask { get; set; }
public DateTime lastUpdate { get; set; }
public double theoResult { get; set; }
public int tradeCount { get; set; }
public bool checkTrigger { get; set; }
public bool bidAskUpdated { get; set; }
public bool quoteUpdated { get; set; }
public int aQuotesCount { get; set; }
}
}
SIGN IN To post a reply.
1 Reply
1 reply marked as answer
RN
Rahul Narayanasamy
Syncfusion Team
March 29, 2021 01:01 PM UTC
Hi Johan,
Greetings from Syncfusion.
Query: Datagrid empty when reading from UrlAdaptor
We have validated your query and we suspect that you are facing problem while binding the data from UrlAdaptor. Here, we have prepared a simple sample based on your requirement. We have rendered a Grid and bound Grid datasource using UrlAdaptor.
For UrlAdaptor adaptor, all request sent from the Grid will be of POST request and data has to be returned in Result and Count format. Find the below documentation links for your reference.
Reference:
|
[HttpPost]
[Route("api/[controller]")]
public object Post([FromBody] DataManagerRequest dm)
{
if (order.Count == 0)
{
BindDataSource();
}
IEnumerable DataSource = order.ToList();
if (dm.Search != null && dm.Search.Count > 0)
{
DataSource = DataOperations.PerformSearching(DataSource, dm.Search); //Search
}
. . .
return new { result = DataSource, count = count };
} |
We suggest you to ensure that whether you have returned the data in Result and Count format or not at your end.
Please let us know if you have any concerns.
Regards,
Rahul
Marked as answer
SIGN IN To post a reply.