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 ...
Get Yii2 By Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.