コード例 #1
0
ファイル: DataTable.php プロジェクト: php-pike/pike
 /**
  * Constructor
  *
  * @param AdapterInterface    $adapter
  * @param DataSourceInterface $dataSource
  * @param ServiceManager      $sm
  */
 public function __construct(AdapterInterface $adapter, DataSourceInterface $dataSource, ServiceManager $sm)
 {
     $this->adapter = $adapter;
     $this->dataSource = $dataSource;
     $this->sm = $sm;
     $columnBag = $this->adapter->getColumnBag();
     foreach ($this->dataSource->getFields() as $field) {
         $columnBag->add($field);
     }
 }
コード例 #2
0
ファイル: DataTables.php プロジェクト: php-pike/pike
 /**
  * {@inheritdoc}
  */
 protected function onSortEvent(DataSourceInterface $dataSource)
 {
     for ($i = 0; $i < count($this->columnBag->getVisible()); $i++) {
         if (isset($this->parameters['iSortCol_' . $i])) {
             $offset = $this->parameters['iSortCol_' . $i];
             $direction = $this->parameters['sSortDir_' . $i];
             $column = $this->columnBag->getOffset($offset);
             $dataSource->addSort($column['field'], $direction);
         }
     }
 }