Class TopicsListView
CListView displays a list of data items in terms of a list.
Unlike CGridView which displays the data items in a table, CListView allows one to use a view template to render each data item. As a result, CListView could generate more flexible rendering result.
CListView supports both sorting and pagination of the data items. The sorting and pagination can be done in AJAX mode or normal page request. A benefit of using CListView is that when the user browser disables JavaScript, the sorting and pagination automatically degenerate to normal page requests and are still functioning as expected.
CListView should be used together with a IDataProvider data provider, preferably a CActiveDataProvider.
The minimal code needed to use CListView is as follows:
$dataProvider=new CActiveDataProvider('Post'); $this->widget('zii.widgets.CListView', array( 'dataProvider'=>$dataProvider, 'itemView'=>'_post', // refers to the partial view named '_post' 'sortableAttributes'=>array( 'title', 'create_time'=>'Post Time', ), ));
The above code first creates a data provider for the Post
ActiveRecord class. It then uses CListView to display every data item as
returned by the data provider. The display is done via the partial view named
'_post'. This partial view will be rendered once for every data item. In the
view, one can access the current data item via variable <span
class="php-var">$data</span>
. For more details, see CListView::$itemView
.
In order to support sorting, one has to specify the CListView::$sortableAttributes
property. By doing so, a list of hyperlinks that can sort
the data will be displayed.
- CComponent
- CBaseController
- CWidget
- CBaseListView
- CListView
- TopicsListView
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.1
Located at x2engine/protected/modules/topics/components/TopicsListView.php
public
|
|
public
|
init(),
registerClientScript(),
renderItems(),
renderSorter()
|
renderContent(),
renderEmptyText(),
renderKeys(),
renderPager(),
renderSection(),
renderSummary(),
run()
|
__construct(),
actions(),
getController(),
getId(),
getOwner(),
getViewFile(),
getViewPath(),
render(),
setId()
|
beginCache(),
beginClip(),
beginContent(),
beginWidget(),
createWidget(),
endCache(),
endClip(),
endContent(),
endWidget(),
renderFile(),
renderInternal(),
widget()
|
__call(),
__get(),
__isset(),
__set(),
__unset(),
asa(),
attachBehavior(),
attachBehaviors(),
attachEventHandler(),
canGetProperty(),
canSetProperty(),
detachBehavior(),
detachBehaviors(),
detachEventHandler(),
disableBehavior(),
disableBehaviors(),
enableBehavior(),
enableBehaviors(),
evaluateExpression(),
getEventHandlers(),
hasEvent(),
hasEventHandler(),
hasProperty(),
raiseEvent()
|
public
CModel
|
$model |
|
#
$model |
$afterAjaxUpdate,
$ajaxType,
$ajaxUpdate,
$ajaxUpdateError,
$ajaxUrl,
$ajaxVar,
$baseScriptUrl,
$beforeAjaxUpdate,
$cssFile,
$enableHistory,
$itemView,
$itemsTagName,
$loadingCssClass,
$separator,
$sortableAttributes,
$sorterCssClass,
$sorterFooter,
$sorterHeader,
$template,
$updateSelector,
$viewData
|
$dataProvider,
$emptyCssClass,
$emptyTagName,
$emptyText,
$enablePagination,
$enableSorting,
$htmlOptions,
$itemsCssClass,
$pager,
$pagerCssClass,
$summaryCssClass,
$summaryTagName,
$summaryText,
$tagName
|
$actionPrefix,
$skin
|
$controller,
$id,
$owner,
$viewPath
|