简体   繁体   中英

Sorting by two columns on an MVC wegrid

At the moment I have a Webgrid which is somewhat like this...

 Server  |  Application  |  Details
---------+---------------+-------------
 Server1 |  Application1 | Example1
 Server2 |  Application2 | Example2
 Server3 |  Application3 | Example3     
 Server4 |  Application4 | Example4

Currently, the Webgrid is sorting itself just on the Server, in alphabetical order. However, each Server may have more than one Application, like this...

 Server  |  Application  |  Details
---------+---------------+-------------
 Server1 |  Application3 | Example3
 Server1 |  Application4 | Example4
 Server1 |  Application1 | Example1     
 Server1 |  Application2 | Example2

The defaultSort is currently set to Server, how can I set the Application column to order itself as a secondary sort in the Webgrid?

I am now dealing with the sort separately to the Webgrid, and ordering the data in the list rather than on the front-end. This seems to offer more granularity and options than doing it with Webgrid.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM