PHP Class yii\widgets\ListView

For more details and usage information on ListView, see the guide article on data widgets.
Since: 2.0
Author: Qiang Xue ([email protected])
Inheritance: extends BaseListView
Datei anzeigen Open project: yiisoft/yii2 Class Usage Examples

Public Properties

Property Type Description
$itemOptions the HTML attributes for the container of the rendering result of each data model. This can be either an array specifying the common HTML attributes for rendering each data item, or an anonymous function that returns an array of the HTML attributes. The anonymous function will be called once for every data model returned by [[dataProvider]]. The "tag" element specifies the tag name of the container element and defaults to "div". If "tag" is false, it means no container element will be rendered. If this property is specified as an anonymous function, it should have the following signature: php function ($model, $key, $index, $widget)
$itemView the name of the view for rendering each data item, or a callback (e.g. an anonymous function) for rendering each data item. If it specifies a view name, the following variables will be available in the view: - $model: mixed, the data model - $key: mixed, the key value associated with the data item - $index: integer, the zero-based index of the data item in the items array returned by [[dataProvider]]. - $widget: ListView, this widget instance Note that the view name is resolved into the view file by the current context of the [[view]] object. If this property is specified as a callback, it should have the following signature: php function ($model, $key, $index, $widget)
$options the HTML attributes for the container tag of the list view. The "tag" element specifies the tag name of the container element and defaults to "div".
$separator the HTML code to be displayed between any two consecutive items.
$viewParams additional parameters to be passed to [[itemView]] when it is being rendered. This property is used only when [[itemView]] is a string representing a view name.

Public Methods

Method Description
renderItem ( mixed $model, mixed $key, integer $index ) : string Renders a single data model.
renderItems ( ) : string Renders all data models.

Method Details

renderItem() public method

Renders a single data model.
public renderItem ( mixed $model, mixed $key, integer $index ) : string
$model mixed the data model to be rendered
$key mixed the key value associated with the data model
$index integer the zero-based index of the data model in the model array returned by [[dataProvider]].
return string the rendering result

renderItems() public method

Renders all data models.
public renderItems ( ) : string
return string the rendering result

Property Details

$itemOptions public_oe property

the HTML attributes for the container of the rendering result of each data model. This can be either an array specifying the common HTML attributes for rendering each data item, or an anonymous function that returns an array of the HTML attributes. The anonymous function will be called once for every data model returned by [[dataProvider]]. The "tag" element specifies the tag name of the container element and defaults to "div". If "tag" is false, it means no container element will be rendered. If this property is specified as an anonymous function, it should have the following signature: php function ($model, $key, $index, $widget)
See also: yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
public $itemOptions

$itemView public_oe property

the name of the view for rendering each data item, or a callback (e.g. an anonymous function) for rendering each data item. If it specifies a view name, the following variables will be available in the view: - $model: mixed, the data model - $key: mixed, the key value associated with the data item - $index: integer, the zero-based index of the data item in the items array returned by [[dataProvider]]. - $widget: ListView, this widget instance Note that the view name is resolved into the view file by the current context of the [[view]] object. If this property is specified as a callback, it should have the following signature: php function ($model, $key, $index, $widget)
public $itemView

$options public_oe property

the HTML attributes for the container tag of the list view. The "tag" element specifies the tag name of the container element and defaults to "div".
See also: yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
public $options

$separator public_oe property

the HTML code to be displayed between any two consecutive items.
public $separator

$viewParams public_oe property

additional parameters to be passed to [[itemView]] when it is being rendered. This property is used only when [[itemView]] is a string representing a view name.
public $viewParams