Database Queries
$dataProvider,
'id' => 'db-panel-detailed-grid',
'options' => ['class' => 'detail-grid-view'],
'filterModel' => $searchModel,
'filterUrl' => $panel->getUrl(),
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'attribute' => 'seq',
'label' => 'Time',
'value' => function ($data) {
$timeInSeconds = $data['timestamp'] / 1000;
$millisecondsDiff = (int)(($timeInSeconds - (int)$timeInSeconds) * 1000);
return date('H:i:s.', $timeInSeconds) . sprintf('%03d', $millisecondsDiff);
},
'headerOptions' => [
'class' => 'sort-numerical'
]
],
[
'attribute' => 'duration',
'value' => function ($data) {
return sprintf('%.1f ms', $data['duration']);
},
'options' => [
'width' => '10%',
],
'headerOptions' => [
'class' => 'sort-numerical'
]
],
[
'attribute' => 'type',
'value' => function ($data) {
return Html::encode(mb_strtoupper($data['type'], 'utf8'));
},
],
[
'attribute' => 'query',
'value' => function ($data) {
$query = Html::encode($data['query']);
if (!empty($data['trace'])) {
$query .= Html::ul($data['trace'], [
'class' => 'trace',
'item' => function ($trace) {
return "{$trace['file']} ({$trace['line']})";
},
]);
}
return $query;
},
'format' => 'html',
'options' => [
'width' => '60%',
],
]
],
]);
?>