Commit c9e4773e by Qiang Xue

Moved key serialization from data provider to data viewers.

parent 975f263e
...@@ -138,9 +138,9 @@ class ActiveDataProvider extends BaseDataProvider ...@@ -138,9 +138,9 @@ class ActiveDataProvider extends BaseDataProvider
foreach ($models as $model) { foreach ($models as $model) {
$kk = []; $kk = [];
foreach ($pks as $pk) { foreach ($pks as $pk) {
$kk[] = $model[$pk]; $kk[$pk] = $model[$pk];
} }
$keys[] = json_encode($kk); $keys[] = $kk;
} }
} }
return $keys; return $keys;
......
...@@ -373,7 +373,7 @@ class GridView extends BaseListView ...@@ -373,7 +373,7 @@ class GridView extends BaseListView
} else { } else {
$options = $this->rowOptions; $options = $this->rowOptions;
} }
$options['data-key'] = $key; $options['data-key'] = is_array($key) ? json_encode($key) : $key;
return Html::tag('tr', implode('', $cells), $options); return Html::tag('tr', implode('', $cells), $options);
} }
......
...@@ -88,7 +88,7 @@ class ListView extends BaseListView ...@@ -88,7 +88,7 @@ class ListView extends BaseListView
$options = $this->itemOptions; $options = $this->itemOptions;
$tag = ArrayHelper::remove($options, 'tag', 'div'); $tag = ArrayHelper::remove($options, 'tag', 'div');
if ($tag !== false) { if ($tag !== false) {
$options['data-key'] = $key; $options['data-key'] = is_array($key) ? json_encode($key) : $key;
return Html::tag($tag, $content, $options); return Html::tag($tag, $content, $options);
} else { } else {
return $content; return $content;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment