亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Yii CGridView用法實(shí)例詳解

 更新時(shí)間:2016年07月12日 15:16:01   作者:Flowf  
這篇文章主要介紹了Yii CGridView用法,結(jié)合實(shí)例形式分析了CGridView的功能、用法與相關(guān)屬性用法,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了Yii CGridView用法。分享給大家供大家參考,具體如下:

CGridView的功能是用來(lái)顯示的數(shù)據(jù)列表。它支持排序,分頁(yè),和AJAX數(shù)據(jù)請(qǐng)求。

CGridView最好使用 data provider,最好是 CActiveDataProvider 。

簡(jiǎn)單代碼如下:

$dataProvider=new CActiveDataProvider('Post');
$this->widget('zii.widgets.grid.CGridView', array(
  'dataProvider'=>$dataProvider,
));

詳細(xì)示例:

$this->widget('zii.widgets.grid.CGridView', array(
  'dataProvider'=>$dataProvider,
  'columns'=>array(
    'title',     // display the 'title' attribute
    'category.name', // display the 'name' attribute of the 'category' relation
    'content:html',  // display the 'content' attribute as purified HTML
    array(      // display 'create_time' using an expression
      'name'=>'create_time',
      'value'=>'date("M j, Y", $data->create_time)',
    ),
    array(      // display 'author.username' using an expression
      'name'=>'authorName',
      'value'=>'$data->author->username',
    ),
    array(      // display a column with "view", "update" and "delete" buttons
      'class'=>'CButtonColumn',
    ),
  ),
));

屬性說(shuō)明:

actionPrefix 方法前輟

afterAjaxUpdate AJAX成功響應(yīng)后調(diào)用的JAVASCRIPT函數(shù)

ajaxUpdate 是否啟用AJAX請(qǐng)求數(shù)據(jù)

ajaxUpdateError AJAX失敗響應(yīng)后調(diào)用的JAVASCRIPT函數(shù)

ajaxUrl AJAX請(qǐng)求的URL

ajaxVar AJAX請(qǐng)求,使用GET方式傳送的變量

baseScriptUrl 視圖資源的URL

beforeAjaxUpdate 在AJAX調(diào)用之前調(diào)用的JAVASCRIPT函數(shù)

blankDisplay 列標(biāo)題為空顯示的內(nèi)容

columns 內(nèi)容列有配置

controller 控制器

cssFile 視圖的樣式

dataProvider 視圖的數(shù)據(jù)

emptyText 內(nèi)容為空顯示的信息

filterPosition 搜索框所在的位置

更多關(guān)于Yii相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Yii框架入門及常用技巧總結(jié)》、《php優(yōu)秀開(kāi)發(fā)框架總結(jié)》、《smarty模板入門基礎(chǔ)教程》、《php日期與時(shí)間用法總結(jié)》、《php面向?qū)ο蟪绦蛟O(shè)計(jì)入門教程》、《php字符串(string)用法總結(jié)》、《php+mysql數(shù)據(jù)庫(kù)操作入門教程》及《php常見(jiàn)數(shù)據(jù)庫(kù)操作技巧匯總

希望本文所述對(duì)大家基于Yii框架的PHP程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論