Yii ListView Widget - Yii

How to use the Yii ListView Widget?

The data is displayed by ListView Widget using a data provider. A specified view file is used to render each model.

Step 1 − The actionDataWidget() method is modified by the code:

In the above code, a data provider is created and passed it to the datawidget view.

Step 2 − The datawidget view file is modified by the code:

The ListView widget is rendered. Each model is rendered in the _user view.

Step 3 – A file _user.php is created inside the views/site folder.

Step 4 − Enter http://localhost:8080/index.php?r=site/data-widget in the address bar of the web browser, and the output appears as:

ListView Widget Example Output

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Yii Topics