Helper for use the PrimeNG table load lazy filter in backend use LINQ to Entity
If you use PrimeNG.TableFilter version 1.x.x you will need to migrate your implementation code. Please delete total record variable and change to get total record from variable out in extension. You can looking for implementation guide line in unit test.
- .NET Standard 2.1
- .NET Framework 4.6.2 more then
- Mono Framework
- Handle all command from PrimeNG table filter frontend
- Filter criteria from PrimeNG table filter in Iterators and Entities
- Convert PrimeNG table filter payload to SQL Query (use LINQ to Entities)
Completely handle PrimeNG table load lazy in ASP.NET use PrimeNG.TableFilter (kusumotolab.com)
PM> Install-Package PrimeNG.TableFilter
- Handle PrimeNG table filter payload in ASP.Net MVC Controller use "TableFilterModel" in parameter from body
[HttpPost("[action]")]
public BaseTableResponseEntity<ClassRoomGridModel> GetClassRoom([FromBody] TableFilterModel tableFilterPayload)
=> _classRoomService.GetClassRoom(tableFilterPayload);
- Implement programming logic for get your data from iterators or entities and use extension method "PrimengTableFilter" in your iterators or entities
public BaseTableResponseEntity<ClassRoomGridModel> GetClassRoom(TableFilterModel filterPayload)
{
var result = _classRoomRepository.Gets()
.Select(o =>
new ClassRoomGridModel
{
Code = o.Code,
Id = o.Id,
TotalSeat = o.TotalSeat,
BuildingName = o.BuildingName.Description,
Name = o.Name,
Remark = o.Remark,
ActiveFlag = o.ActiveFlag,
Type = GenerateClassRoomTypeToText(o.Type)
}
);
result = result.PrimengTableFilter(filterPayload, out var totalRecord);
return MvcHelper.ResponseTableData(totalRecord, result);
}
MIT License
Copyright (c) 2021 Weerayut Hongsa