From 53e193049f7cb52e035737fa45c46f738a73a040 Mon Sep 17 00:00:00 2001 From: MDMunir <misbahuldmunir@gmail.com> Date: Thu, 22 May 2014 17:57:30 +0700 Subject: [PATCH] Add $key to function parameter I think it's better to enclose `$key` as function parameter. --- framework/grid/DataColumn.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/grid/DataColumn.php b/framework/grid/DataColumn.php index b1a79b0..5263189 100644 --- a/framework/grid/DataColumn.php +++ b/framework/grid/DataColumn.php @@ -51,7 +51,7 @@ class DataColumn extends Column public $label; /** * @var string|\Closure an anonymous function that returns the value to be displayed for every data model. - * The signature of this function is `function ($model, $index, $widget)`. + * The signature of this function is `function ($model, $key, $index, $widget)`. * If this is not set, `$model[$attribute]` will be used to obtain the value. * * You may also set this property to a string representing the attribute name to be displayed in this column. @@ -176,7 +176,7 @@ class DataColumn extends Column if (is_string($this->value)) { return ArrayHelper::getValue($model, $this->value); } else { - return call_user_func($this->value, $model, $index, $this); + return call_user_func($this->value, $model, $key, $index, $this); } } elseif ($this->attribute !== null) { return ArrayHelper::getValue($model, $this->attribute); -- libgit2 0.27.1