How to customize the output of the Widgets

Hi dears,

I have fetched the data using Data Provide of Database.

I want to customize it.

Please let me know to do it?

Thanks

Widgets can use regular views.

Create a directory called ‘views’ in the directory where your widgets are stored, and then you can render your widget data like this:


	public function run() {

// this method is called by CController::endWidget()

    	$this->render('whateverView');

	}



That would require a whateverView.php in widget_directory/views. ;)

If you refer to Zii widget (CGridView, CListView and so on) refer to the api referece for all customization issue.

If you need some more detailed help, please ask more detailed what exactly you need.

zaccaria thanks.

I need a detailed information about it.

I have one more question.

Either we use Grid or List view using the data provider, will all the columns of the database table are accessed or the values that we use to display?

Thanks

You can access all the columns of your database table in key->value fashion. If you have table with columns ‘id’,‘name’,‘email’ then you access ‘name’ with $data->name and if you need email you use $data->email.

When you use the dataProvider, it will load all column from the database.

For select only some column, you should change the creation of dataprovider, and set some restriction.

For example, in the function module there is the creation of the dataprovider used from the actuon admin.

Add something like that:




$criteria->select='all fields you want to select';


return new CActiveDataProvider'''




This will select only the columns you want.

zaccaria

Thanks for you nice explanation.

viter

thanks dear