PHP Development Framework Yii Framework Tutorial (ZII) Component-gridview sample

Source: Internet
Author: User
Tags expression yii

Cgridview displays data in tabular form, Cgridview also supports paging and sorting, Cgridview the most basic usage and ListView types, and also by setting data provider, usually cactivedataprovider.

Modify the previous example Yii Framework development Tutorial (a) Zii component-detailview example, ListView should be the GridView:

<?php $this->widget (' Zii.widgets.grid.CGridView ', Array (
	' Dataprovider ' => $dataProvider,
	' Ajaxupdate ' =>false,
	' template ' => ' {pager}{summary}{items}{pager} ',
 
);?>

The results appear as follows:

You can see that the GridView defaults to displaying all the fields and displays the fields in the default format, and you can do this by configuring the Cgridview::columns property if you want to control the display and formatting of the fields. Each column of the GridView is a Cgridcolumn object:

Cgridcolumn is the base class for all grid list items, and each instance of the table can have a header, multiple data units, and an optional footer cell.

Cbuttoncolumn indicates that the cell is one or more buttons, the default display of three buttons, "View", "Update" and "delete" can be changed by setting buttons and template.

Ccheckboxcolumn indicates that the cell is a checkbox, supports read-only, single or multiple selections, and modifies the selectablerows by configuring the

Cdatacolumn indicates that the unit is data or an expression, by configuring name or value, which represents the property name of the data model, the latter code a PHP expression.

Clinkcolumn represents a hyperlink that sets the link by configuring a label, URL, or ImageUrl.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.