I know this could be a silly question.. but I am trying to align the filter and the CListView widget to show it appropriately as below
Here is the code
<div class="row-fluid span12">
<div class="span4">
<?php $box = $this->beginWidget(
'bootstrap.widgets.TbBox',
array(
'title' => 'Advanced Search',
'headerIcon' => 'icon-th-list',
'htmlOptions' => array('class' => 'bootstrap-widget-table')
)
);?>
<?php $this->renderPartial('_search',array('model'=>$model,)); ?>
<?php $this->endWidget(); ?>
</div>
<div class="span8">
<?php
$this->widget('zii.widgets.CListView',
array(
'dataProvider'=>$model->search(),
'ajaxUpdate' => true,
'enablePagination'=>true,
'itemView'=>'_list', // refers to the partial view named '_post'
'sortableAttributes'=>array(
'Price',
'Year',
'Lenght'
),
)
);
?>
</div>
</div>
which actually generates something like left side of the attached picture
How can I make sure that the CListView widget is aligned within the filter? And get rid of the text "Displaying 1-29 results" and align the filters on the top?
My solution is a bit longer but bear with me.
The default layout for
CListItem
is as follows:To achieve your desired layout, you need to somehow insert the filter in the container i.e. the
.items
div. This can be done in several ways.You can overwrite the ListView class to add a variable
beforeItems
whose content will be placed in the item container but before the first item. e.gYou can then call your list view as:
However, to ensure that your listview looks as in the image, you will need to extend the listview to remove some the rendering of the opening and closing container tag commented out in the example below.
You can then edit
template
to remove the summary and pager that appear before the items: