Skip to content

Latest commit

 

History

History
70 lines (51 loc) · 2.6 KB

README.md

File metadata and controls

70 lines (51 loc) · 2.6 KB

PrimeNG.TableFilter

NuGet version Build Status

Helper for use the PrimeNG table load lazy filter in backend use LINQ to Entity

Breaking change in version 2.0

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 Platform Support

  • .NET Standard 2.1
  • .NET Framework 4.6.2 more then
  • Mono Framework

Features

  • 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)

Release Note

Completely handle PrimeNG table load lazy in ASP.NET use PrimeNG.TableFilter (kusumotolab.com)

Install via Nuget Package Manager

PM> Install-Package PrimeNG.TableFilter

How to use

  1. 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);
  1. 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