Yii DataView Latte Help

ListView

The listView tag represents a ListView widget>. It displays a list of data items.

Parameters

The listView tag has two parameters:

Parameter

Type

Description

$dataReader

Yiisoft\Data\Reader\ReadableDataInterface

An instance of ReadableDataInterface.

$view

Closure|string

Either:

A Closure that is a callback that renders each item; the signature is function ($data, $key, int $index, ListView $widget): string.

or:

A string that is the path to the view that renders each item.

Configuration

The listView tag can be configured using the Latte filter syntax. A configuration filter has the name of the ListView configuration method and accepts the same type as the method's parameter; e.g. {listView $data|header: 'Users'} will set the header of the ListView. The exception is methods that have variable-length argument lists; these must be passed as an array.

Usage

{varType Yiisoft\Data\Reader\ReadableDataInterface $dataReader} {varType Closure|string $itemView} {listView $dataReader, $itemView|header: 'Users'}
Last modified: 17 May 2025