O'Reilly logo

Yii2 By Example by Fabrizio Caldarelli

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A summarized footer row in a grid

One feature of GridView is that it shows summarized or statistical data, usually as a footer row or first row, to get the data immediately (instead of scrolling down the page to the bottom of the grid).

A column of the GridView widget has an attribute named footer to identify the last row of the current pagination. A value filled in this attribute will be placed in the last row of the grid.

By default, showing the footer is disabled; to enable the footer, it is enough to set the attribute showFooter of GridView to true. Then, we need to insert data in the 'footer' attribute of the column that we want to show.

For example, we want to display the average price per day of rooms.

Add this code at the top of the grid view ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required