Using grids
Zii grids are very useful to quickly create efficient application admin pages or any pages on which you need to manage data.
Let's use Gii to generate a grid, see how it works, and how we can customize it.
Getting ready
Carry out the following steps:
Create a new application using
yiic webappas described in the official guide.Download the Sakila database from http://dev.mysql.com/doc/index-other.html. Execute the downloaded SQLs (first schema then data).
Configure the database connection in
protected/config/main.php.Use Gii to create models for the
customer,address, andcitytables.
How to do it...
Open Gii, select Crud Generator, and enter
Customerinto the Model Class field. Press Preview and then Generate.Gii will generate a controller in
protected/controllers/CustomerController.phpand a group of views underprotected/views/customer/.Run the
customercontroller and go to the Manage Customer link. After logging in you should see the grid generated, as shown in the following screenshot...