Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SortableHeaderFor custom Model #23

Open
mdmota opened this issue Apr 1, 2019 · 5 comments
Open

SortableHeaderFor custom Model #23

mdmota opened this issue Apr 1, 2019 · 5 comments

Comments

@mdmota
Copy link

mdmota commented Apr 1, 2019

Describe the bug
My page contain @model CustomModel:
@model Test.Web.Models.CustomModel

CustomModel contain property PagingList:
public ReflectionIT.Mvc.Paging.PagingList MyList{ get; set; }

How i use SortableHeaderFor for columns from MyList from CustomModel?
@Html.SortableHeaderFor(model => model.MyList.NameColumn) ** Dont work

@mdmota
Copy link
Author

mdmota commented May 22, 2019

@sonnemaf

@sonnemaf
Copy link
Owner

Have you looked at this sample: https://github.com/sonnemaf/ReflectionIT.Mvc.Paging/blob/master/src/SampleApp/Views/Products/Index.cshtml ?

I think you need to use the extra overload in which you specify the sort string.

@Html.SortableHeaderFor(model => model.MyList.NameColumn, "MyList.NameColumn")

@thereelaristotle
Copy link

Any further followups here? I am trying to do the exact same thing as the OP and can't get access to the SortableHeaderFor...everything else is looking fine.

@thereelaristotle
Copy link

thereelaristotle commented Apr 22, 2020

What I ultimately ended up doing was creating a class called ExtendedPagingList...then building an additional Helper method to work with any models that derive from ExtendedPagingList.

It works the only thing is that it cannot infer the type of the elements in the PagingList....so you need to specify them in the function call to SortableHeaderFor, might be a way around this but after like 5 hours I don't care to dig.

@sonnemaf
Copy link
Owner

Can you create a project for this problem and publish it in a public github repository? I will have a look at it. Don't have time to create one myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants