Fixes #2083: make sure keys of object type work with ActionColumn, GridView, etc.

This commit is contained in:
Qiang Xue
2014-02-13 12:04:37 -05:00
parent d445ab9d6f
commit 25b466d278
4 changed files with 4 additions and 5 deletions

View File

@ -123,7 +123,7 @@ class ActionColumn extends Column
if ($this->urlCreator instanceof Closure) {
return call_user_func($this->urlCreator, $action, $model, $key, $index);
} else {
$params = is_array($key) ? $key : ['id' => $key];
$params = is_array($key) ? $key : ['id' => (string)$key];
$route = $this->controller ? $this->controller . '/' . $action : $action;
return Yii::$app->controller->createUrl($route, $params);
}

View File

@ -379,7 +379,7 @@ class GridView extends BaseListView
} else {
$options = $this->rowOptions;
}
$options['data-key'] = is_array($key) ? json_encode($key) : $key;
$options['data-key'] = is_array($key) ? json_encode($key) : (string)$key;
return Html::tag('tr', implode('', $cells), $options);
}