[gridview] -- Column源码
来源:互联网 发布:数据库物理设计图visio 编辑:程序博客网 时间:2024/06/14 08:21
<?php/** * @link http://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license http://www.yiiframework.com/license/ */namespace yii\grid;use Closure;use yii\base\Object;use yii\helpers\Html;/** * Column is the base class of all [[GridView]] column classes. * * @author Qiang Xue <qiang.xue@gmail.com> * @since 2.0 */class Column extends Object{ /** * @var GridView the grid view object that owns this column. * @var GridView 拥有这一列的网格视图object */ public $grid; /** * @var string the header cell content. Note that it will not be HTML-encoded. * @var string 标题单元格内容。请注意,它不会HTML-encoded。 */ public $header; /** * @var string the footer cell content. Note that it will not be HTML-encoded. * @var string 底部单元格内容, 请注意, 他不会html-encoded */ public $footer; /** * @var callable This is a callable that will be used to generate the content of each cell. * The signature of the function should be the following: `function ($model, $key, $index, $column)`. * Where `$model`, `$key`, and `$index` refer to the model, key and index of the row currently being rendered * and `$column` is a reference to the [[Column]] object * * @var callable 这个调用将用于生成每个单元格的内容。 * 函数的签名应该如下:`function ($model, $key, $index, $column)` */ public $content; /** * @var boolean whether this column is visible. Defaults to true. * @var boolean 这一列是否可见。默认值为true。 */ public $visible = true; /** * @var array the HTML attributes for the column group tag. * @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered. * @var array HTML属性列组标签。 * @see \yii\helpers\Html::renderTagAttributes() 属性是如何被渲染的细节 */ public $options = []; /** * @var array the HTML attributes for the header cell tag. * @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered. * @var array HTML头部单元标签 * @see \yii\helpers\Html::renderTagAttributes() 属性是如何被渲染的细节 */ public $headerOptions = []; /** * @var array|\Closure the HTML attributes for the data cell tag. This can either be an array of * attributes or an anonymous function ([[Closure]]) that returns such an array. * The signature of the function should be the following: `function ($model, $key, $index, $column)`. * Where `$model`, `$key`, and `$index` refer to the model, key and index of the row currently being rendered * and `$column` is a reference to the [[Column]] object. * A function may be used to assign different attributes to different rows based on the data in that row. * * @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered. * @var array|\Closure HTML属性数据单元标签。这可以是一个数组 * 属性或一个匿名函数function ([[Closure]]) 返回一个数组 * 函数的签名应该是以下: `function ($model, $key, $index, $column)`. * Where `$model`, `$key`, and `$index` refer to the model, key and index of the row currently being rendered * [[column]]是一个引用对象 * 一个函数可以用来将不同属性分配给不同的行基于这一行中的数据。 * @see \yii\helpers\Html::renderTagAttributes() 属性是如何被渲染的细节 */ public $contentOptions = []; /** * @var array the HTML attributes for the footer cell tag. * @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered. */ public $footerOptions = []; /** * @var array the HTML attributes for the filter cell tag. * @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered. */ public $filterOptions = []; /** * Renders the header cell. */ public function renderHeaderCell() { return Html::tag('th', $this->renderHeaderCellContent(), $this->headerOptions); } /** * Renders the footer cell. */ public function renderFooterCell() { return Html::tag('td', $this->renderFooterCellContent(), $this->footerOptions); } /** * Renders a data cell. * @param mixed $model the data model being rendered * @param mixed $key the key associated with the data model * @param integer $index the zero-based index of the data item among the item array returned by [[GridView::dataProvider]]. * @return string the rendering result */ public function renderDataCell($model, $key, $index) { if ($this->contentOptions instanceof Closure) { $options = call_user_func($this->contentOptions, $model, $key, $index, $this); } else { $options = $this->contentOptions; } return Html::tag('td', $this->renderDataCellContent($model, $key, $index), $options); } /** * Renders the filter cell. */ public function renderFilterCell() { return Html::tag('td', $this->renderFilterCellContent(), $this->filterOptions); } /** * Renders the header cell content. * 渲染头部单元格内容 * The default implementation simply renders [[header]]. * This method may be overridden to customize the rendering of the header cell. * 这种方法可能会覆盖自定义标题单元格的渲染。 * @return string the rendering result * @return string 返回渲染结果 */ protected function renderHeaderCellContent() { return trim($this->header) !== '' ? $this->header : $this->grid->emptyCell; } /** * Renders the footer cell content. * The default implementation simply renders [[footer]]. * This method may be overridden to customize the rendering of the footer cell. * @return string the rendering result */ protected function renderFooterCellContent() { return trim($this->footer) !== '' ? $this->footer : $this->grid->emptyCell; } /** * Renders the data cell content. * @param mixed $model the data model * @param mixed $key the key associated with the data model * @param integer $index the zero-based index of the data model among the models array returned by [[GridView::dataProvider]]. * @return string the rendering result */ protected function renderDataCellContent($model, $key, $index) { if ($this->content !== null) { return call_user_func($this->content, $model, $key, $index, $this); } else { return $this->grid->emptyCell; } } /** * 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). * @return string the rendering result */ protected function renderFilterCellContent() { return $this->grid->emptyCell; }}
0 0
- [gridview] -- Column源码
- GridView column的隐藏
- 建立GridView Column
- Merge Same Data Column in Gridview
- Gallery + GridView (源码)
- [gridview] -- ActionColumn源码
- GridView 后台排列 Column 、 用户自定义GridView 显示、GridView的PreRender ,Init,Load 方法
- GridView Export Excel and set display column visible status
- 动态设定GridView的高度,固定column,实现高度自适应
- @Column
- @Column
- @Column
- @Column
- @Column
- @Column
- @Column
- @Column
- column
- 14(高级)CSS动画之:旋转星球
- Socket编程
- 使用common-fileUpload制作文件上传(DiskFileItemFactory方式)
- hadoop下linux集群间设置ssh免密登录
- 【LeetCode题解】链表Linked Lis
- [gridview] -- Column源码
- C++ primer学习之类型转换(1) 隐式转换
- pdf阅读器与迅捷pdf编辑器的使用方法
- 浅析软件产品生命周期的重要角色
- 算法训练 摆动序列
- Nginx的使用
- for循环中的++i和i++(摘抄总结)
- webgis里对于有收缩框的布局地图显示的问题
- 搭建测试环境