sort() публичный Метод

Sorts the DataTable rows using the supplied callback function.
public sort ( string $functionCallback, string $columnSortedBy )
$functionCallback string A comparison callback compatible with {@link usort}.
$columnSortedBy string The column name `$functionCallback` sorts by. This is stored so we can determine how the DataTable was sorted in the future.
Пример #1
0
 /**
  * See {@link Sort}.
  *
  * @param DataTable $table
  * @return mixed
  */
 public function filter($table)
 {
     if ($table instanceof Simple) {
         return;
     }
     if (empty($this->columnToSort)) {
         return;
     }
     $rows = $table->getRows();
     if (count($rows) == 0) {
         return;
     }
     $row = current($rows);
     if ($row === false) {
         return;
     }
     $this->columnToSort = $this->selectColumnToSort($row);
     $value = $row->getColumn($this->columnToSort);
     if (is_numeric($value)) {
         $methodToUse = "numberSort";
     } else {
         if ($this->naturalSort) {
             $methodToUse = "naturalSort";
         } else {
             $methodToUse = "sortString";
         }
     }
     $table->sort(array($this, $methodToUse), $this->columnToSort);
 }