Example #1
0
 /**
  * Which are the sortable columns
  * @param array $sortableColumns
  * @return \BootstrapUI\Table\Remote
  */
 public function sortableColumns(array $sortableColumns)
 {
     $this->sortableColumns = $sortableColumns;
     foreach ($sortableColumns as $index) {
         $this->table->renderTh($index, function ($index, $column, $columns) {
             $dataLabel = str_replace('"', '"', $column['label']);
             $width = $column['width'] !== null ? " style=\"width:{$column['width']}px\"" : '';
             return "<th class=\"x-remote-sortable-column\"{$width}><a href=\"#\" class=\"x-remote-sortable-{$index}\" data-field=\"{$index}\" data-label=\"{$dataLabel}\">{$column['label']}</a></th>";
         });
     }
     return $this;
 }