LinkSorter will generate a hyperlink for every attribute declared in [[sort]]. For more details and usage information on LinkSorter, see the guide article on sorting.
부터: 2.0
저자: Qiang Xue (qiang.xue@gmail.com)
상속: extends yii\base\Widget
예제 #1
0
 /**
  * Renders the sorter.
  * @return string the rendering result
  */
 public function renderSorter()
 {
     $sort = $this->dataProvider->getSort();
     if ($sort === false || empty($sort->attributes) || $this->dataProvider->getCount() <= 0) {
         return '';
     }
     /* @var $class LinkSorter */
     $sorter = $this->sorter;
     $class = ArrayHelper::remove($sorter, 'class', LinkSorter::className());
     $sorter['sort'] = $sort;
     $sorter['view'] = $this->getView();
     return $class::widget($sorter);
 }
예제 #2
0
 /**
  * Renders sorter
  * @param array $options
  * @return string
  * @throws \Exception
  */
 public function sorter($options = [])
 {
     return $this->_adp ? LinkSorter::widget(array_merge($options, ['sort' => $this->_adp->sort])) : '';
 }
예제 #3
0
 public function run()
 {
     if ($this->show) {
         parent::run();
     }
 }
예제 #4
0
<?php

use yii\widgets\LinkPager;
use yii\widgets\LinkSorter;
use yii\grid\GridView;
?>

<?php 
echo LinkSorter::widget(['sort' => $sort]);
?>

<?php 
foreach ($models as $model) {
    ?>
    <?php 
    echo $model->id;
}
?>


<?php 
// display pagination
echo LinkPager::widget(['pagination' => $pages]);
?>

<br />
<br />
<br />
<hr />
<br />