|
- <?php
- /**
- * Created by PhpStorm.
- * User: wangxj
- * Date: 2017/7/31
- * Time: 13:26
- */
-
- namespace common\components;
-
- use kartik\grid\DataColumn;
- use yii\db\ActiveQuery;
-
- /**
- * Class zDataColumn
- *
- * @property bool|array $pagerButtons
- * @property ActiveQuery $query
- */
-
- class zDataColumn extends DataColumn
- {
- public $query;
-
- protected function getPageSummaryCellContent()
- {
- $this->filterWidgetOptions;
- if ($this->pageSummary === true || $this->pageSummary instanceof \Closure) {
- if($this->attribute != null){
- $query = $this->query;
- $query->orderBy(false);
- $summary = $this->query->sum($this->attribute);
-
- }
- else
- $summary = $this->calculateSummary();
- return ($this->pageSummary === true) ? $summary : call_user_func(
- $this->pageSummary,
- $summary,
- $this->_rows,
- $this
- );
- }
- if ($this->pageSummary !== false) {
- return $this->pageSummary;
- }
- return null;
- }
-
- }
|