CBaseListView
Package | zii.widgets |
---|---|
Inheritance | abstract class CBaseListView » CWidget » CBaseController » CComponent |
Subclasses | CGridView, CListView |
Since | 1.1 |
Version | $Id: CBaseListView.php 196 2010-06-28 21:44:54Z qiang.xue $ |
CBaseListView implements the common features needed by a view wiget for rendering multiple models.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
actionPrefix | string | the prefix to the IDs of the actions. | CWidget |
controller | CController | the controller that this widget belongs to. | CWidget |
dataProvider | IDataProvider | the data provider for the view. | CBaseListView |
emptyText | string | the message to be displayed when dataProvider does not have any data. | CBaseListView |
enablePagination | boolean | whether to enable pagination. | CBaseListView |
enableSorting | boolean | whether to enable sorting. | CBaseListView |
htmlOptions | array | the HTML options for the view container tag. | CBaseListView |
id | string | id of the widget. | CWidget |
itemsCssClass | string | the CSS class name for the container of all data item display. | CBaseListView |
loadingCssClass | string | the CSS class name that will be assigned to the widget container element when the widget is updating its content via AJAX. | CBaseListView |
owner | CBaseController | owner/creator of this widget. | CWidget |
pager | array | the configuration for the pager. | CBaseListView |
pagerCssClass | string | the CSS class name for the pager container. | CBaseListView |
skin | mixed | the name of the skin to be used by this widget. | CWidget |
summaryCssClass | string | the CSS class name for the summary text container. | CBaseListView |
summaryText | string | the summary text template for the view. | CBaseListView |
tagName | string | the tag name for the view container. | CBaseListView |
template | string | the template to be used to control the layout of various sections in the view. | CBaseListView |
viewPath | string | Returns the directory containing the view files for this widget. | CWidget |
Public Methods
Method | Description | Defined By |
---|---|---|
__call() | Calls the named method which is not a class method. | CComponent |
__construct() | Constructor. | CWidget |
__get() | Returns a property value, an event handler list or a behavior based on its name. | CComponent |
__isset() | Checks if a property value is null. | CComponent |
__set() | Sets value of a component property. | CComponent |
__unset() | Sets a component property to be null. | CComponent |
actions() | Returns a list of actions that are used by this widget. | CWidget |
asa() | Returns the named behavior object. | CComponent |
attachBehavior() | Attaches a behavior to this component. | CComponent |
attachBehaviors() | Attaches a list of behaviors to the component. | CComponent |
attachEventHandler() | Attaches an event handler to an event. | CComponent |
beginCache() | Begins fragment caching. | CBaseController |
beginClip() | Begins recording a clip. | CBaseController |
beginContent() | Begins the rendering of content that is to be decorated by the specified view. | CBaseController |
beginWidget() | Creates a widget and executes it. | CBaseController |
canGetProperty() | Determines whether a property can be read. | CComponent |
canSetProperty() | Determines whether a property can be set. | CComponent |
createWidget() | Creates a widget and initializes it. | CBaseController |
detachBehavior() | Detaches a behavior from the component. | CComponent |
detachBehaviors() | Detaches all behaviors from the component. | CComponent |
detachEventHandler() | Detaches an existing event handler. | CComponent |
disableBehavior() | Disables an attached behavior. | CComponent |
disableBehaviors() | Disables all behaviors attached to this component. | CComponent |
enableBehavior() | Enables an attached behavior. | CComponent |
enableBehaviors() | Enables all behaviors attached to this component. | CComponent |
endCache() | Ends fragment caching. | CBaseController |
endClip() | Ends recording a clip. | CBaseController |
endContent() | Ends the rendering of content. | CBaseController |
endWidget() | Ends the execution of the named widget. | CBaseController |
evaluateExpression() | Evaluates a PHP expression or callback under the context of this component. | CComponent |
getController() | CWidget | |
getEventHandlers() | Returns the list of attached event handlers for an event. | CComponent |
getId() | CWidget | |
getOwner() | CWidget | |
getViewFile() | Looks for the view script file according to the view name. | CWidget |
getViewPath() | Returns the directory containing the view files for this widget. | CWidget |
hasEvent() | Determines whether an event is defined. | CComponent |
hasEventHandler() | Checks whether the named event has attached handlers. | CComponent |
hasProperty() | Determines whether a property is defined. | CComponent |
init() | Initializes the view. | CBaseListView |
raiseEvent() | Raises an event. | CComponent |
registerClientScript() | Registers necessary client scripts. | CBaseListView |
render() | Renders a view. | CWidget |
renderContent() | Renders the main content of the view. | CBaseListView |
renderEmptyText() | Renders the empty message when there is no data. | CBaseListView |
renderFile() | Renders a view file. | CBaseController |
renderInternal() | Renders a view file. | CBaseController |
renderItems() | Renders the data items for the view. | CBaseListView |
renderKeys() | Renders the key values of the data in a hidden tag. | CBaseListView |
renderPager() | Renders the pager. | CBaseListView |
renderSummary() | Renders the summary text. | CBaseListView |
run() | Renders the view. | CBaseListView |
setId() | CWidget | |
widget() | Creates a widget and executes it. | CBaseController |
Protected Methods
Method | Description | Defined By |
---|---|---|
renderSection() | Renders a section. | CBaseListView |
Property Details
the data provider for the view.
the message to be displayed when dataProvider does not have any data.
whether to enable pagination. Note that if the IDataProvider::pagination property of dataProvider is false, this will be treated as false as well. When pagination is enabled, a pager will be displayed in the view so that it can trigger pagination of the data display. Defaults to true.
whether to enable sorting. Note that if the IDataProvider::sort property of dataProvider is false, this will be treated as false as well. When sorting is enabled, sortable columns will have their headers clickable to trigger sorting along that column. Defaults to true.
See Also
- sortableAttributes
the HTML options for the view container tag.
the CSS class name for the container of all data item display. Defaults to 'items'.
the CSS class name that will be assigned to the widget container element when the widget is updating its content via AJAX. Defaults to 'loading'.
the configuration for the pager. Defaults to array('class'=>'CLinkPager')
.
See Also
the CSS class name for the pager container. Defaults to 'pager'.
the CSS class name for the summary text container. Defaults to 'summary'.
the summary text template for the view. These tokens are recognized and will be replaced with the corresponding values:
- {start}: the starting row number (1-based) currently being displayed
- {end}: the ending row number (1-based) currently being displayed
- {count}: the total number of rows
- {page}: the page number (1-based) current being displayed, available since version 1.1.3
- {pages}: the total number of pages, available since version 1.1.3
the tag name for the view container. Defaults to 'div'.
the template to be used to control the layout of various sections in the view. These tokens are recognized: {summary}, {items} and {pager}. They will be replaced with the summary text, the items, and the pager.
Method Details
public void init()
|
Initializes the view. This method will initialize required property values and instantiate columns objects.
public void registerClientScript()
|
Registers necessary client scripts. This method is invoked by run. Child classes may override this method to register customized client scripts.
public void renderContent()
|
Renders the main content of the view. The content is divided into sections, such as summary, items, pager. Each section is rendered by a method named as "renderXyz", where "Xyz" is the section name. The rendering results will replace the corresponding placeholders in template.
public void renderEmptyText()
|
Renders the empty message when there is no data.
abstract public void renderItems()
|
Renders the data items for the view. Each item is corresponding to a single data model instance. Child classes should override this method to provide the actual item rendering logic.
public void renderKeys()
|
Renders the key values of the data in a hidden tag.
public void renderPager()
|
Renders the pager.
protected string renderSection(array $matches)
| ||
$matches | array | the matches, where $matches[0] represents the whole placeholder, while $matches[1] contains the name of the matched placeholder. |
{return} | string | the rendering result of the section |
Renders a section. This method is invoked by renderContent for every placeholder found in template. It should return the rendering result that would replace the placeholder.
public void renderSummary()
|
Renders the summary text.
public void run()
|
Renders the view. This is the main entry of the whole view rendering. Child classes should mainly override renderContent method.