Don't render summary on gridviews?

How to avoid the COUNT sql statement generated by CGridView and not to render Summary (the section with text "Displaying xxx of xxx result(s).")?

It’s possible to change the summary text.

See CBaseListView::summaryText

As for the COUNT sql statement, I think it will be executed regardless of the summary text, because the pagination will need the row count.

For anyone who was wondering:

$this->widget(‘zii.widgets.grid.CGridView’, array(












    'dataProvider'=>new CArrayDataProvider($model->donations, 











The summary can be moved or excluded by defining template explicitly.


I tend to use the template property to achieve this. You can use skins to apply this at a global level across all your widgets. Or you can subclass the grid view and redefine the template property in there but that’s normally only if you need to change behaviour.

I agree with the previous two replies. Using the template variable is much better. Here is an example of how you can form the template variable using ob. This example was taken from CListView but it is much the same:

ob_start(); ?>

//        {summary}  //Omitted to stop summary from showing



	<table class="list_sub_objects_in_series" style='width:100%;' cellspacing="0" cellpadding="0"><thead>




			<th>sub title</th>



			<th>Shown on website</th>




	$list_template = ob_get_contents();


It’s pitty that only solution is editing template. It would be much better to add “enableSummary” property to CGridview

CGridView template is a simple attribute with default value:

public $template="{summary}\n{items}\n{pager}";

so changing it is not such great challenge…