Yii Framework Forum: GridView render problem - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

GridView render problem Gridview doesn't render css Rate Topic: -----

#1 User is offline   guizma 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 21-October 15

Posted 21 October 2015 - 10:09 AM

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([
			'query'=>$query,
			'pagination'=>$pagination,
		]);
		
		return GridView::widget([
    		'dataProvider' => $provider,
    		'columns'=>[
    			'node',
    			'sensor',
    			'value',
    			'timestamp:date',
    		]
    	]);
	}	
}


What am I doing wrong? Thank you in advance.

Attached File(s)


0

#2 User is offline   Bizley 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 922
  • Joined: 29-July 14
  • Location:Wrocław

Posted 21 October 2015 - 10:56 AM

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

http://www.yiiframew...-gridview-yii2/
http://www.sitepoint...w-and-listview/
http://www.bsourceco...iframework-2-0/
http://bizley.pl ʕ•ᴥ•ʔ
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users