Hi, i'm using Syncfusion Grid Control with a WebApi.
In the Index.cshtml i use this code for the grid definition:
<ej-grid id="UsersGrid" datasource="ViewBag.datasource" allow-paging="true" locale="it-IT" action-failure="OnActionFailure">
<e-toolbar-settings show-toolbar="true" toolbar-items=@(new List<string>() {"excelExport","wordExport","pdfExport" })>
</e-toolbar-settings>
<e-page-settings page-size="2" enable-query-string="true"></e-page-settings>
<e-datamanager url="http://localhost:5110/api/countries" adaptor="WebApiAdaptor"></e-datamanager>
<e-columns>
<e-column field="Id" header-text="ID Nazione" text-align="Right" width="75"></e-column>
<e-column field="CountryName" header-text="Nazione" text-align="Right" width="75"></e-column>
<e-column field="IstatCode" header-text="Codice Isat" text-align="Right" width="75"></e-column>
<e-column field="IsoCode" header-text="Codice Iso" text-align="Right" width="75"></e-column>
<e-column field="StartDate" header-text="Data Inizio" text-align="Right" width="75"></e-column>
<e-column field="EndDate" header-text="Data Fine" text-align="Right" width="75"></e-column>
</e-columns>
</ej-grid>
This is the Web Api code :
public object Get()
{
DataPage<Country> countries = null;
using (var uow = _uowProvider.CreateUnitOfWork())
{
var repository = uow.GetRepository<Country>();
var queryString = Request.Query;
int skip = Convert.ToInt32(queryString["$skip"]);
int take = Convert.ToInt32(queryString["$top"]);
skip = skip > 0 ? skip : 1;
countries = _pager.Get(skip, take);
return new { Items = countries, Count = countries.TotalEntityCount };
}
}
To manage the database access i use Digipolis.DataAccess, and Digipolis.DataAccess.Paging;
The result of this operation is Table empty and the browser console say : TypeError: this.model.currentViewData is undefined.
It's all correct ?
Thanks in advance
Stefano