sonnemaf / ReflectionIT.Mvc.Paging

ASP.NET Core 3.0 Paging (including filtering and sorting) solution using Entity Framework Core 3.0 and IEnumerable<T>
MIT License
79 stars 37 forks source link

SortableHeaderFor to include additional query string parameters #34

Open junnavarra opened 4 years ago

junnavarra commented 4 years ago

Hi,

I have several query string parameters in my Index controller such as filter, pageindex, sortExpression and groupName. The SortableHeaderFor used for sorting generates a link which contains only the sortExpression parameter, for example, the razor code @Html.SortableHeaderFor(model => model.ItemDesc) generates the url http://localhost:60755/InventoryManagement/Index?sortExpression=-ItemDesc

I want to include the groupName that contains a value that I need to retain during sorting and will be passed also as parameter together with the sortExpression in the query string which will result to, something like this:

http://localhost:60755/InventoryManagement/Index?sortExpression=-ItemDesc&groupName=Supplies

Would it be possible?

Thank you for your guidance.

m0ddixx commented 2 years ago

You have to add them into the PagingList.RouteValues dictionary. The keys are the parameter names.