Commit 330cee17 authored by john's avatar john

3010

parent 6a54644e
...@@ -49,7 +49,10 @@ class SearchDocList extends DocList ...@@ -49,7 +49,10 @@ class SearchDocList extends DocList
$idListInt[] = (int) $_id; $idListInt[] = (int) $_id;
$query = DocList::find(); $query = DocList::find();
$query->joinWith(['lang']); $query->joinWith(['lang']);
$query->orderBy([ new \yii\db\Expression('FIELD (`doc_list`.`id`, ' . implode(',', $idListInt) . ')')]);
$sort = yii::$app->request->get('sort');
if (!$sort)
$query->orderBy([new \yii\db\Expression('FIELD (`doc_list`.`id`, ' . implode(',', $idListInt) . ')')]);
$dataProvider = new ActiveDataProvider([ $dataProvider = new ActiveDataProvider([
'query' => $query, 'query' => $query,
'sort' => [ 'sort' => [
......
...@@ -28,10 +28,12 @@ $parentList = $searchModel->getParentList($searchModel, 0, 0, true); ...@@ -28,10 +28,12 @@ $parentList = $searchModel->getParentList($searchModel, 0, 0, true);
], ],
[ [
'attribute' => 'name', 'attribute' => 'name',
'format'=>'raw', 'format' => 'raw',
'value' => function($model)use($parentList) { 'value' => function($model)use($parentList) {
return '<p style="white-space: nowrap;">'.$parentList[$model->id . ' '].'</p>'; $sort = yii::$app->request->get('sort');
// return $model->lang->name; if (!$sort)
return '<p style="white-space: nowrap;">' . $parentList[$model->id . ' '] . '</p>';
return $model->lang->name;
} }
], ],
[ [
......
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