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

Set the default order to the primary key #25

Open
luizfbicalho opened this issue Aug 3, 2016 · 1 comment
Open

Set the default order to the primary key #25

luizfbicalho opened this issue Aug 3, 2016 · 1 comment

Comments

@luizfbicalho
Copy link

If the request doen't have an ordering, the entity framework returns an error to do the paging, so it could be better to set the default ordering to the Primary key of the entity if it doesn't have any order.

just like this, but getting the correct field using reflection

    if (request.Sort == null || request.Sort.Count() == 0)
    {
        var sort = new List<Sort>();
        sort.Add(new Sort() { Dir = "asc", Field = "Id" });
        request.Sort = sort;
    }
@mshtawythug
Copy link

I forked it and added a default sort to either Id or any other column that has Id in it or just the first column

https://github.com/mshtawythug/dlinq-helpers/tree/master/Kendo.DynamicLinq

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

2 participants