I'm using the NonFactors MVC6.Grid. I'm pretty much just using the base grid:
@(Html
.Grid(Model.Parts)
.Build(columns =>
{
columns.Add(model => model.PartNumber).Titled("Part Number");
columns.Add(model => model.Description).Titled("Description");
columns.Add(model => model.ProductCode).Titled("Product Code");
columns.Add(model => model.Warehouse).Titled("Warehouse");
})
.Filterable()
.Sortable()
.Pageable(pager =>
{
pager.RowsPerPage = 20;
})
)
As you can see, the grid is bound to the Parts
property of the model:
[BindProperty]
public List<PartModel> Parts { get; set; } = new List<PartModel>();
The problem I'm having is that when I sort or filter on the MVC6.Grid, it does a POST since the data doesn't persist between requests, the grid ends up trying to sort on nothing.
Parts
is populated by a search function. Is the only way to do this is re-populate parts when the grid performs a post? And if that's the case, is there a way to tie into the post event?
Ideally, it would be great if the grid could sort and filter local data without posting.