Sorting

Sorting

When displaying multiple rows of data, it is often needed that the data be sorted according to some columns specified by end users. Yii uses a yii\data\Sort object to represent the information about a sorting schema. In particular,

  • attributes specifies the attributes by which the data can be sorted. An attribute can be as simple as a model attribute. It can also be a composite one by combining multiple model attributes or DB columns. More details will be given in the following.
  • attributeOrders gives the currently requested ordering directions for each attribute.
  • orders gives the orde