Yii Framework Forum

GridView render problem

(Guizzzmo) #1

Hi, I’m a newbie in the Yii world and I have already faced a problem following the Yii tour.

When trying to display the data from a DB using the GridView widget, I get a terrible formatted output. Attached you can find the screenshot.

My controller code:

class SensorsDataController extends Controller {


	function actionIndex(){


		$query = SensorsData::find();


		$pagination = new Pagination([

			'defaultPageSize' => 12,

			'totalCount' => $query->count(),



		$provider = new ActiveDataProvider([





		return GridView::widget([

    		'dataProvider' => $provider,










What am I doing wrong? Thank you in advance.

(Pawel) #2

Use GridView inside the view that you render from the controller’s action like here: