Returns the data cell value.
public getDataCellValue ( mixed $model, mixed $key, integer $index ) : string | ||
$model | mixed | the data model |
$key | mixed | the key associated with the data model |
$index | integer | the zero-based index of the data model among the models array returned by [[GridView::dataProvider]]. |
return | string | the data cell value |
/** * @inheritdoc */ public function getDataCellValue($model, $key, $index) { if ($this->value !== null) { return parent::getDataCellValue($model, $key, $index); } else { $class = $this->menuClass; return $class::create(['model' => $model])->render(MenuButton::class); } }
/** * @inheritdoc */ public function getDataCellValue($model, $key, $index) { if ($this->value !== null) { return parent::getDataCellValue($model, $key, $index); } $attributeSet = $this->attribute !== null; $mappingSet = is_array($this->valueMapping); $vKey = ArrayHelper::getValue($model, $this->attribute); if ($attributeSet && $mappingSet && isset($this->valueMapping[$vKey])) { return $this->valueMapping[$vKey]; } return parent::getDataCellValue($model, $key, $index); }
/** * @inheritdoc * @param mixed $model * @param mixed $key * @param int $index * @return null|string * @throws InvalidConfigException */ public function getDataCellValue($model, $key, $index) { if (count($this->editable) == 2) { if (is_string($this->editable[0]) && $this->editable[0] == 'editor') { $editorConfig = call_user_func($this->editable[1], $model, $key, $index, $this); $this->initEditableColumns($model, $editorConfig); if ($this->value !== null) { if (is_string($this->value)) { return Html::a(ArrayHelper::getValue($model, $this->value), '', $editorConfig); } else { return Html::a(call_user_func($this->value, $model, $key, $index, $this), '', $editorConfig); } } elseif ($this->attribute !== null) { return Html::a(ArrayHelper::getValue($model, $this->attribute), '', $editorConfig); } } else { throw new InvalidConfigException('配置错误'); } return null; } else { return parent::getDataCellValue($model, $key, $index); } }
/** * @param mixed $model * @param mixed $key * @param int $index * @return mixed */ public function getDataCellValue($model, $key, $index) { $value = parent::getDataCellValue($model, $key, $index); return ArrayHelper::getValue($this->enum, $value, $value); }
/** * @inheritdoc */ public function getDataCellValue($model, $key, $index) { $value = parent::getDataCellValue($model, $key, $index); if ($this->trueValue !== true) { if ($value == $this->falseValue) { return $this->falseIcon; } else { return $this->trueIcon; } } else { if ($value !== null) { return $value ? $this->trueIcon : $this->falseIcon; } return $this->showNullAsFalse ? $this->falseIcon : $value; } }
public function getDataCellValue($model, $key, $index) { $value = parent::getDataCellValue($model, $key, $index); $this->_total += $value; return $value; }