Hello
In controller I use CActiveDataProvider for fetching my data from database.
In view I use zii.widget.CListView for showing the data but I want to put each 3 results in a div.
Please help me,
Hello
In controller I use CActiveDataProvider for fetching my data from database.
In view I use zii.widget.CListView for showing the data but I want to put each 3 results in a div.
Please help me,
I guess you can apply some styling (specifying width + floating the div).
You can also specify which CSS file / CSS classes you want to use in your ListView.
I didn’t find answer my question in that page. I want this position
<div class='row'>
// data item 1
// data item 2
// data item 3
</div>
<div class='row'>
// data item 4
// data item 5
// data item 6
</div>
.
.
. until end
The idea is to change the styling of the container div, in order that it has like 30% width and that it floats left, and 5% right-margin.
Otherwise, you can just use this extension that renders the listview items into a table of as many columns as you want: http://www.yiiframework.com/extension/ecolumnlistview/
You can use $index variable in your partial view for the CListView.
<?php if ($index % 3 === 0): ?>
<div class="row">
<?php endif; ?>
... rendering item ...
<?php if ($index % 3 === 2 || $index === $widget->dataProvider->itemCount - 1): ?>
</div>
<?php endif; ?>
http://www.yiiframework.com/doc/api/1.1/CListView#itemView-detail
the problem is solved;
thank you very much for helping me