J, 19 bytes
(]/:~"1/:)"_ 1],:/:
- Main verb
]/:~"1/:- The right most
/:sorts the left arg (matrix) according to the order that would sort the right arg (specified order). This sorts rows. - Now that result get sorted
/:~"1again according to the order specified]. But this time we're sorting with rank 1, ie, we're sorting each row, which has the effect of sorting columns.
- The right most
],:/:We apply the above using both the order specified]and the grade up of the order specified/:. This gives us the 2 results we want.
J, 19 bytes
(]/:~"1/:)"_ 1],:/:
- Main verb
]/:~"1/:- The right most
/:sorts the left arg (matrix) according to the order that would sort the right arg (specified order). This sorts rows. - Now that result get sorted
/:~"1again according to the order specified]. But this time we're sorting with rank 1, ie, we're sorting each row, which has the effect of sorting columns.
- The right most
],:/:We apply the above using both the order specified]and the grade up of the order specified/:. This gives us the 2 results we want.