Tubular provides a .NET library to easily create responses in WebApi library (or WCF) for your Tubular grids. This helpers and extension methods provide sorting, filtering and pagination using System.Linq.Dynamic.
You can install from Nuget:
You first need to setup your ApiController. All the request made by Tubular Grid are using HTTP POST method, in order to send a
This model provides an extension method to generate a payload using any
IQueryable data source like
an Entity Framework query.
The internal helper will deliver a
This model is the expected payload for Tubular Grid. You need to use both classes in order to use Tubular Grid properly, if you only return
List<T> the Tubular component won't be able to populate.
Since you pass a IQueryable as parameter, you can filter or apply any security level control before to call the
CreateGridDataResponse. If you require to
apply any transformation that you can't perform in, for example, Entity Framework like convert date to a specific string format you can use a final output
ProcessResponseSubset function argument).
From the previous sample, the second argument in
CreateGridDataResponse function is a static function where the input parameter is anonymous
and returns another anonymous
IQueryable. You need to cast the inner list in order to materialize from Entity Framework IQueryable. Using a second IQueryable to return
is recommended instead to modify the incoming
It's important to use the
ProcessResponseSubset parameter to perform any transformation to improve performance because if you materialize your Entity Framework
IQueryable before to pass it to Tubular, all the paging and filtering will apply to the complete dataset.