CListView自体から拡張する方がよいでしょうが、 CBaseListViewのメソッドの新しい実装と、run()
CListViewのメソッドrenderItems()
の新しい実装を記述します。次に例を示します。
Yii::import('zii.widgets.CListView');
class MListView extends CListView{
public function run(){
$this->registerClientScript();
// this line renders the first div
//echo CHtml::openTag($this->tagName,$this->htmlOptions)."\n";
$this->renderContent();
$this->renderKeys();
//echo CHtml::closeTag($this->tagName);
}
public function renderItems(){
//this line renders the second div
//echo CHtml::openTag($this->itemsTagName,array('class'=>$this->itemsCssClass))."\n";
// copy original code from the function
//echo CHtml::closeTag($this->itemsTagName);
}
}
編集:
jquery.yiilistview.jsは、このリストビューを識別するIDがないと機能しないため、デフォルトのclistview機能の一部はこれだけでは機能しないことに注意してください。
編集:
更新された質問から、これを行うことができます。
<div id="some-id">
<?php
$this->widget('ext.extendedwidgets.MListView',array(
'id'=>'some-id', // same id you specified in the div
//... rest of it
'template' => '{items}', // as seen in the chat below
));
</div>