Yii Framework v1.1.10 绫诲弬鑰

CGridColumn

zii.widgets.grid
缁ф壙 abstract class CGridColumn » CComponent
瀛愮被 CButtonColumn, CCheckBoxColumn, CDataColumn, CLinkColumn
婧愯嚜 1.1
鐗堟湰 $Id: CGridColumn.php 3426 2011-10-25 00:01:09Z alexander.makarow $
婧愮爜 framework/zii/widgets/grid/CGridColumn.php
CGridColumn鏄墍鏈夌殑琛ㄦ牸瑙嗗浘涓垪绫荤殑鍩虹被銆

A CGridColumn object represents the specification for rendering the cells in a particular grid view column.

In a column, there is one header cell, multiple data cells, and an optional footer cell. Child classes may override renderHeaderCellContent, renderDataCellContent and renderFooterCellContent to customize how these cells are rendered.

鍏叡灞炴

闅愯棌缁ф壙灞炴

灞炴绫诲瀷鎻忚堪瀹氫箟鍦
cssClassExpression string 璁$畻PHP琛ㄨ揪寮忎腑姣忎竴涓暟鎹厓浠讹紝 鍏剁粨鏋滀綔涓鸿繖涓暟鎹厓浠剁殑CSS绫诲悕銆傚湪杩欎釜琛ㄨ揪寮忎腑锛 鍙橀噺$row鏄鍙凤紙闆跺熀纭锛夛紱 $data鏄琛岀殑鏁版嵁妯″瀷锛 $this鏄垪鐨勫璞° CGridColumn
footerHtmlOptions array HTML涓簳閮ㄥ厓浠舵爣绛剧殑閫夐」銆 CGridColumn
grid CGridView 鎷ユ湁姝ゅ垪鐨勮〃鏍艰鍥惧璞° CGridColumn
hasFooter boolean 纭畾姝ゅ垪鏄惁鏈夊簳閮ㄥ厓浠躲 杩欏喅瀹氬熀浜庢槸鍚footer宸茶缃 CGridColumn
headerHtmlOptions array HTML涓ご閮ㄥ厓浠舵爣绛剧殑閫夐」銆 CGridColumn
htmlOptions array HTML涓暟鎹厓浠舵爣绛剧殑閫夐」銆 CGridColumn
id string the ID of this column. CGridColumn
visible boolean 姝ゅ垪鏄惁鍙銆傞粯璁や负true銆 CGridColumn

鍏叡鏂规硶

闅愯棌缁ф壙鏂规硶

鏂规硶鎻忚堪瀹氫箟鍦
__call() 濡傛灉绫讳腑娌℃湁璋冪殑鏂规硶鍚嶏紝鍒欒皟鐢ㄨ繖涓柟娉曘 CComponent
__construct() 鏋勯犳柟娉曘 CGridColumn
__get() 杩斿洖涓涓睘鎬у笺佷竴涓簨浠跺鐞嗙▼搴忓垪琛ㄦ垨涓涓涓哄悕绉般 CComponent
__isset() 妫鏌ヤ竴涓睘鎬ф槸鍚︿负null銆 CComponent
__set() 璁剧疆涓涓粍浠剁殑灞炴у笺 CComponent
__unset() 璁剧疆涓涓粍浠剁殑灞炴т负null銆 CComponent
asa() 杩斿洖杩欎釜鍚嶅瓧鐨勮涓哄璞° CComponent
attachBehavior() 闄勫姞涓涓涓哄埌缁勪欢銆 CComponent
attachBehaviors() 闄勫姞涓涓涓哄垪琛ㄥ埌缁勪欢銆 CComponent
attachEventHandler() 涓轰簨浠堕檮鍔犱竴涓簨浠跺鐞嗙▼搴忋 CComponent
canGetProperty() 纭畾灞炴ф槸鍚﹀彲璇汇 CComponent
canSetProperty() 纭畾灞炴ф槸鍚﹀彲鍐欍 CComponent
detachBehavior() 浠庣粍浠朵腑鍒嗙涓涓涓恒 CComponent
detachBehaviors() 浠庣粍浠朵腑鍒嗙鎵鏈夎涓恒 CComponent
detachEventHandler() 鍒嗙涓涓瓨鍦ㄧ殑浜嬩欢澶勭悊绋嬪簭銆 CComponent
disableBehavior() 绂佺敤涓涓檮鍔犺涓恒 CComponent
disableBehaviors() 绂佺敤缁勪欢闄勫姞鐨勬墍鏈夎涓恒 CComponent
enableBehavior() 鍚敤涓涓檮鍔犺涓恒 CComponent
enableBehaviors() 鍚敤缁勪欢闄勫姞鐨勬墍鏈夎涓恒 CComponent
evaluateExpression() 璁$畻涓涓狿HP琛ㄨ揪寮忥紝鎴栨牴鎹粍浠朵笂涓嬫枃鎵ц鍥炶皟銆 CComponent
getEventHandlers() 杩斿洖涓涓簨浠剁殑闄勫姞澶勭悊绋嬪簭鍒楄〃銆 CComponent
getHasFooter() 杩斿洖纭畾姝ゅ垪鏄惁鏈夊簳閮ㄥ厓浠躲 杩欏喅瀹氬熀浜庢槸鍚footer宸茶缃 CGridColumn
hasEvent() 纭畾涓涓簨浠舵槸鍚﹀畾涔夈 CComponent
hasEventHandler() 妫鏌ヤ簨浠舵槸鍚︽湁闄勫姞鐨勫鐞嗙▼搴忋 CComponent
hasProperty() 纭畾灞炴ф槸鍚﹁瀹氫箟銆 CComponent
init() 鍒濆鍖栧垪銆 CGridColumn
raiseEvent() 鍙戣捣涓涓簨浠躲 CComponent
renderDataCell() 娓叉煋涓涓暟鎹厓浠躲 CGridColumn
renderFilterCell() 娓叉煋杩囨护鍣ㄥ厓浠躲 CGridColumn
renderFooterCell() 娓叉煋搴曢儴鍏冧欢銆 CGridColumn
renderHeaderCell() 娓叉煋澶撮儴鍏冧欢銆 CGridColumn

鍙椾繚鎶ゆ柟娉

闅愯棌缁ф壙鏂规硶

鏂规硶鎻忚堪瀹氫箟鍦
renderDataCellContent() Renders the data cell content. CGridColumn
renderFilterCellContent() Renders the filter cell content. CGridColumn
renderFooterCellContent() Renders the footer cell content. CGridColumn
renderHeaderCellContent() Renders the header cell content. CGridColumn

灞炴ц缁

cssClassExpression 灞炴
public string $cssClassExpression;

璁$畻PHP琛ㄨ揪寮忎腑姣忎竴涓暟鎹厓浠讹紝 鍏剁粨鏋滀綔涓鸿繖涓暟鎹厓浠剁殑CSS绫诲悕銆傚湪杩欎釜琛ㄨ揪寮忎腑锛 鍙橀噺$row鏄鍙凤紙闆跺熀纭锛夛紱 $data鏄琛岀殑鏁版嵁妯″瀷锛 $this鏄垪鐨勫璞°

public string $footer;

搴曢儴鍏冧欢鏂囨湰銆傝娉ㄦ剰锛屽畠涓嶄細鍙樻垚HTML缂栫爜銆

footerHtmlOptions 灞炴
public array $footerHtmlOptions;

HTML涓簳閮ㄥ厓浠舵爣绛剧殑閫夐」銆

grid 灞炴
public CGridView $grid;

鎷ユ湁姝ゅ垪鐨勮〃鏍艰鍥惧璞°

hasFooter 灞炴 鍙
public boolean getHasFooter()

纭畾姝ゅ垪鏄惁鏈夊簳閮ㄥ厓浠躲 杩欏喅瀹氬熀浜庢槸鍚footer宸茶缃

header 灞炴
public string $header;

澶撮儴鍏冧欢鏂囨湰銆傝娉ㄦ剰锛屽畠涓嶄細鍙樻垚HTML缂栫爜銆

headerHtmlOptions 灞炴
public array $headerHtmlOptions;

HTML涓ご閮ㄥ厓浠舵爣绛剧殑閫夐」銆

htmlOptions 灞炴
public array $htmlOptions;

HTML涓暟鎹厓浠舵爣绛剧殑閫夐」銆

id 灞炴
public string $id;

the ID of this column. This value should be unique among all grid view columns. If this is set, it will be assigned one automatically.

visible 灞炴
public boolean $visible;

姝ゅ垪鏄惁鍙銆傞粯璁や负true銆

鏂规硶璇︾粏

__construct() 鏂规硶
public void __construct(CGridView $grid)
$grid CGridView 鎷ユ湁姝ゅ垪鐨勮〃鏍艰鍥俱
婧愮爜锛 framework/zii/widgets/grid/CGridColumn.php#76 (鏄剧ず)
public function __construct($grid)
{
    
$this->grid=$grid;
}

鏋勯犳柟娉曘

getHasFooter() 鏂规硶
public boolean getHasFooter()
{return} boolean 纭畾姝ゅ垪鏄惁鏈夊簳閮ㄥ厓浠躲 杩欏喅瀹氬熀浜庢槸鍚footer宸茶缃
婧愮爜锛 framework/zii/widgets/grid/CGridColumn.php#94 (鏄剧ず)
public function getHasFooter()
{
    return 
$this->footer!==null;
}

init() 鏂规硶
public void init()
婧愮爜锛 framework/zii/widgets/grid/CGridColumn.php#86 (鏄剧ず)
public function init()
{
}

鍒濆鍖栧垪銆 琛ㄦ牸瑙嗗浘鍒濆鍖栨椂鑷韩娓叉煋涔嬪墠璋冪敤姝ゆ柟娉曘 鎮ㄥ彲浠ラ噸鍐欐鏂规硶锛屽噯澶囨覆鏌撳垪銆

renderDataCell() 鏂规硶
public void renderDataCell(integer $row)
$row integer 琛屾暟锛堥浂鍩虹锛
婧愮爜锛 framework/zii/widgets/grid/CGridColumn.php#125 (鏄剧ず)
public function renderDataCell($row)
{
    
$data=$this->grid->dataProvider->data[$row];
    
$options=$this->htmlOptions;
    if(
$this->cssClassExpression!==null)
    {
        
$class=$this->evaluateExpression($this->cssClassExpression,array('row'=>$row,'data'=>$data));
        if(isset(
$options['class']))
            
$options['class'].=' '.$class;
        else
            
$options['class']=$class;
    }
    echo 
CHtml::openTag('td',$options);
    
$this->renderDataCellContent($row,$data);
    echo 
'</td>';
}

娓叉煋涓涓暟鎹厓浠躲

renderDataCellContent() 鏂规硶
protected void renderDataCellContent(integer $row, mixed $data)
$row integer the row number (zero-based)
$data mixed the data associated with the row
婧愮爜锛 framework/zii/widgets/grid/CGridColumn.php#178 (鏄剧ず)
protected function renderDataCellContent($row,$data)
{
    echo 
$this->grid->blankDisplay;
}

Renders the data cell content. This method SHOULD be overridden to customize the rendering of the data cell.

renderFilterCell() 鏂规硶 锛堝彲鐢ㄨ嚜 v1.1.1锛
public void renderFilterCell()
婧愮爜锛 framework/zii/widgets/grid/CGridColumn.php#103 (鏄剧ず)
public function renderFilterCell()
{
    echo 
"<td>";
    
$this->renderFilterCellContent();
    echo 
"</td>";
}

娓叉煋杩囨护鍣ㄥ厓浠躲

renderFilterCellContent() 鏂规硶 锛堝彲鐢ㄨ嚜 v1.1.1锛
protected void renderFilterCellContent()
婧愮爜锛 framework/zii/widgets/grid/CGridColumn.php#189 (鏄剧ず)
protected function renderFilterCellContent()
{
    echo 
$this->grid->blankDisplay;
}

Renders the filter cell content. The default implementation simply renders a space. This method may be overridden to customize the rendering of the filter cell (if any).

renderFooterCell() 鏂规硶
public void renderFooterCell()
婧愮爜锛 framework/zii/widgets/grid/CGridColumn.php#145 (鏄剧ず)
public function renderFooterCell()
{
    echo 
CHtml::openTag('td',$this->footerHtmlOptions);
    
$this->renderFooterCellContent();
    echo 
'</td>';
}

娓叉煋搴曢儴鍏冧欢銆

renderFooterCellContent() 鏂规硶
protected void renderFooterCellContent()
婧愮爜锛 framework/zii/widgets/grid/CGridColumn.php#167 (鏄剧ず)
protected function renderFooterCellContent()
{
    echo 
trim($this->footer)!=='' $this->footer $this->grid->blankDisplay;
}

Renders the footer cell content. The default implementation simply renders footer. This method may be overridden to customize the rendering of the footer cell.

renderHeaderCell() 鏂规硶
public void renderHeaderCell()
婧愮爜锛 framework/zii/widgets/grid/CGridColumn.php#113 (鏄剧ず)
public function renderHeaderCell()
{
    
$this->headerHtmlOptions['id']=$this->id;
    echo 
CHtml::openTag('th',$this->headerHtmlOptions);
    
$this->renderHeaderCellContent();
    echo 
"</th>";
}

娓叉煋澶撮儴鍏冧欢銆

renderHeaderCellContent() 鏂规硶
protected void renderHeaderCellContent()
婧愮爜锛 framework/zii/widgets/grid/CGridColumn.php#157 (鏄剧ず)
protected function renderHeaderCellContent()
{
    echo 
trim($this->header)!=='' $this->header $this->grid->blankDisplay;
}

Renders the header cell content. The default implementation simply renders header. This method may be overridden to customize the rendering of the header cell.

Copyright © 2008-2011 by Yii Software LLC
All Rights Reserved.