How do you sort an array on multiple columns?

前端 未结 16 1138
面向向阳花
面向向阳花 2020-11-22 13:02

I have a multidimensional array. The primary array is an array of

[publicationID][publication_name][ownderID][owner_name] 

What I am tryin

16条回答
  •  忘了有多久
    2020-11-22 13:49

    I think what you're looking for is thenBy.js: https://github.com/Teun/thenBy.js

    It allows you to use the standard Array.sort, but with firstBy().thenBy().thenBy() style.

    An example can be seen here.

提交回复
热议问题