嗨,我在链接器页面中分页有问题。
我的问题 https://gyazo.com/cc9b04c3114d6cfd09ef376b5d4374ac
我使用 https://github.com/kartik-v/yii2-tabs-x
当我想使用分页时,我会得到原始 html,如何在屏幕上。我的控制台浏览器显示错误
"资源解释为文档,但使用 MIME 类型应用程序/json 传输:" {我的网址} 我的控制器
public function actionTestTabs()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$MovieData = seanse::find()->innerJoinWith(['idMovie', 'idRoom']
)->where(['active' => 'active'])
->groupBy('name');
$date = seanse::find()->innerJoinWith(['idMovie', 'idRoom']
)->where(['active' => 'active'])
->orderBy('name')->all();
$dataProvider = new ActiveDataProvider([
'query' => $MovieData,
'pagination' => [
'totalCount' => 1,
'pageSize' => 1,
],
]);
return $this->renderPartial('test', [
'MovieData' => $MovieData,
'dataProvider' => $dataProvider,
'date' => $date,
]);
}
我的观点
foreach ($month as $item) {
$items[] = [
'label' => $item,
'linkOptions' => ['data-url' => Url::to(['repertuar/test-tabs'])],
];
}
echo TabsX::widget([
'align' => TabsX::ALIGN_CENTER,
'items' => $items,
]);
怎么了?
有什么问题?您已在行中设置了"json"响应标头:
Yii::$app->response->format = Response::FORMAT_JSON;
只需从代码中删除此行或对其进行注释即可。