Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
144256 | Apr 26,2019 10:05 PM UTC | Jun 5,2019 12:46 PM UTC | Blazor | 5 |
![]() |
Tags: Grid |
@page "/"
@using Syncfusion.EJ2.RazorComponents.Grids;
@using WebApplication1.Shared.Models;
@using Syncfusion.EJ2.RazorComponents.Data
<EjsGrid id="Grid" ref="@grid" AllowSorting="true">
<EjsDataManager Url="/api/Default" Adaptor="Adaptors.WebApiAdaptor"></EjsDataManager>
<GridColumns>
<GridColumn Field="EmployeeID" HeaderText="Employee ID" ISPrimaryKey="true" TextAlign="@Syncfusion.EJ2.RazorComponents.Grids.TextAlign.Right" Width="90"></GridColumn>
<GridColumn Field="FirstName" HeaderText="First Name" Width="90"></GridColumn>
<GridColumn Field="LastName" HeaderText=" Last Name" Width="90"></GridColumn>
<GridColumn Field="City" HeaderText="City" Width="150"></GridColumn>
</GridColumns>
</EjsGrid>
@functions{
Employee[] data;
EjsGrid grid;
}
|
...
namespace WebApplication1.Server.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class DefaultController : ControllerBase
{
EmployeeDataAccessLayer objemployee = new EmployeeDataAccessLayer();
// GET: api/Default
[HttpGet]
public object Get()
{
IEnumerable<Employee> data = objemployee.GetAllEmployees().ToList();
return new { Items = data, Count = data.Count() }; }
// GET: api/Default/5
[HttpGet("{id}", Name = "Get")]
...
}
}
|
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().AddNewtonsoftJson(options => {
options.SerializerSettings.ContractResolver = new DefaultContractResolver();
});
...
} |
$inlinecount=allpages
$orderby=ColName%20desc
$skip=0
$top=12
int count = DataSource.Cast<OrdersDetails>().Count();
if (dm.Skip != 0)
{
DataSource = operation.PerformSkip(DataSource, dm.Skip); //Paging
}
if (dm.Take != 0)
{
DataSource = operation.PerformTake(DataSource, dm.Take);
}
. . . |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.