PHP Class yii\widgets\BaseListView

It provides features like sorting, paging and also filtering the data. For more details and usage information on BaseListView, see the guide article on data widgets.
Since: 2.0
Author: Qiang Xue ([email protected])
Inheritance: extends yii\base\Widget
Mostra file Open project: yiisoft/yii2 Class Usage Examples

Public Properties

Property Type Description
$dataProvider the data provider for the view. This property is required.
$emptyText the HTML content to be displayed when [[dataProvider]] does not have any data.
$emptyTextOptions the HTML attributes for the emptyText of the list view. The "tag" element specifies the tag name of the emptyText element and defaults to "div".
$layout the layout that determines how different sections of the list view should be organized. The following tokens will be replaced with the corresponding section contents: - {summary}: the summary section. See BaseListView::renderSummary. - {items}: the list items. See BaseListView::renderItems. - {sorter}: the sorter. See BaseListView::renderSorter. - {pager}: the pager. See BaseListView::renderPager.
$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".
$pager the configuration for the pager widget. By default, LinkPager will be used to render the pager. You can use a different widget class by configuring the "class" element. Note that the widget must support the pagination property which will be populated with the [[\yii\data\BaseDataProvider::pagination|pagination]] value of the [[dataProvider]].
$showOnEmpty whether to show the list view if [[dataProvider]] returns no data.
$sorter the configuration for the sorter widget. By default, LinkSorter will be used to render the sorter. You can use a different widget class by configuring the "class" element. Note that the widget must support the sort property which will be populated with the [[\yii\data\BaseDataProvider::sort|sort]] value of the [[dataProvider]].
$summary the HTML content to be displayed as the summary of the list view. If you do not want to show the summary, you may set it with an empty string. The following tokens will be replaced with the corresponding values: - {begin}: the starting row number (1-based) currently being displayed - {end}: the ending row number (1-based) currently being displayed - {count}: the number of rows currently being displayed - {totalCount}: the total number of rows available - {page}: the page number (1-based) current being displayed - {pageCount}: the number of pages available
$summaryOptions the HTML attributes for the summary of the list view. The "tag" element specifies the tag name of the summary element and defaults to "div".

Public Methods

Method Description
init ( ) Initializes the view.
renderEmpty ( ) : string Renders the HTML content indicating that the list view has no data.
renderItems ( ) : string Renders the data models.
renderPager ( ) : string Renders the pager.
renderSection ( string $name ) : string | boolean Renders a section of the specified name.
renderSorter ( ) : string Renders the sorter.
renderSummary ( ) Renders the summary text.
run ( ) Runs the widget.

Method Details

init() public method

Initializes the view.
public init ( )

renderEmpty() public method

Renders the HTML content indicating that the list view has no data.
See also: emptyText
public renderEmpty ( ) : string
return string the rendering result

renderItems() abstract public method

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

renderPager() public method

Renders the pager.
public renderPager ( ) : string
return string the rendering result

renderSection() public method

If the named section is not supported, false will be returned.
public renderSection ( string $name ) : string | boolean
$name string the section name, e.g., `{summary}`, `{items}`.
return string | boolean the rendering result of the section, or false if the named section is not supported.

renderSorter() public method

Renders the sorter.
public renderSorter ( ) : string
return string the rendering result

renderSummary() public method

Renders the summary text.
public renderSummary ( )

run() public method

Runs the widget.
public run ( )

Property Details

$dataProvider public_oe property

the data provider for the view. This property is required.
public $dataProvider

$emptyText public_oe property

the HTML content to be displayed when [[dataProvider]] does not have any data.
public $emptyText

$emptyTextOptions public_oe property

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

$layout public_oe property

the layout that determines how different sections of the list view should be organized. The following tokens will be replaced with the corresponding section contents: - {summary}: the summary section. See BaseListView::renderSummary. - {items}: the list items. See BaseListView::renderItems. - {sorter}: the sorter. See BaseListView::renderSorter. - {pager}: the pager. See BaseListView::renderPager.
public $layout

$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

$pager public_oe property

the configuration for the pager widget. By default, LinkPager will be used to render the pager. You can use a different widget class by configuring the "class" element. Note that the widget must support the pagination property which will be populated with the [[\yii\data\BaseDataProvider::pagination|pagination]] value of the [[dataProvider]].
public $pager

$showOnEmpty public_oe property

whether to show the list view if [[dataProvider]] returns no data.
public $showOnEmpty

$sorter public_oe property

the configuration for the sorter widget. By default, LinkSorter will be used to render the sorter. You can use a different widget class by configuring the "class" element. Note that the widget must support the sort property which will be populated with the [[\yii\data\BaseDataProvider::sort|sort]] value of the [[dataProvider]].
public $sorter

$summary public_oe property

the HTML content to be displayed as the summary of the list view. If you do not want to show the summary, you may set it with an empty string. The following tokens will be replaced with the corresponding values: - {begin}: the starting row number (1-based) currently being displayed - {end}: the ending row number (1-based) currently being displayed - {count}: the number of rows currently being displayed - {totalCount}: the total number of rows available - {page}: the page number (1-based) current being displayed - {pageCount}: the number of pages available
public $summary

$summaryOptions public_oe property

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