Removing CListItem elements from being created

Hi all,

I am using CListView to render a view of items but by default this will add two divs to the HTML as follows:

<div id="yw0" class="list-view">

    <div class="items">

I have found that I can add additional elements if I please but can anyone tell me how I stop these two elements from being generated?

hi you can remove you CListView and use this instead


$data = $dataProvider->getData();

foreach($data as $i => $item)


    array('index' => $i, 'data' => $item, 'widget' => $this));


will give you exact same thing but without the additional html

when using CListView/CGridView you can manually give it a "id".

and the "items" css can be anything you want but the div structure should better as it is .itemsCssClass

if you truly want modify the div structure you may have to extends it

OK, thanks for the responses.

I tried alirz23’s method but this leaves the view without any pagination which I require.

Does anyone else have anything to add?

Edit: Nevermind. I concede that it can’t be done without extending.

Note that if you remove those DIVs the sorting/pagination will not work with ajax calls as they use those DIVs to dynamically replace the content of the div to update the data (new page or sorting order)

OK. Thanks for this. I do want to keep the pagination.