Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Sorting on a navigational property #278


User avatar
0
sai kovvuri created

Hello ,

If we have an entity class A and it has a property of type entity class B. On the DTO back out to view, how do we provide capability to sort on non-key fields of class B. By default, sorting/flitering works if the user sorts/filter on a column that exists on entity A, but not on entity class B.

Thanks, Sai


3 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    This is actually not related to ABP. So, you may find better answers on Stackoverflow. Have you tried to create a LINQ with join and order by ?

  • User Avatar
    0
    sai kovvuri created

    Thanks . I figured it out

    if class B looks like public class B { public string Name {get; set;} }

    public class A { public B B1 {get; set;} }

    set ISortedResultRequest.Sorting = "B1.Name ASC" , thebackend is able to add that to the query

  • User Avatar
    0
    szilardd created

    Thanks @Sai Kovvuri. This worked for me also