SortableCListView
Package | Yii Sortable Model |
---|---|
Inheritance | class SortableCListView » CListView » CBaseListView » CWidget » CBaseController » CComponent |
Since | 1.0 |
Source Code | extensions//widgets/SortableCListView.php |
CListView widget extended to list records sorted.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
actionPrefix | string | the prefix to the IDs of the actions. | CWidget |
afterAjaxUpdate | string | a javascript function that will be invoked after a successful AJAX response is received. | CListView |
ajaxUpdate | mixed | the ID of the container whose content may be updated with an AJAX response. | CListView |
ajaxUrl | mixed | the URL for the AJAX requests should be sent to. | CListView |
ajaxVar | string | the name of the GET variable that indicates the request is an AJAX request triggered by this widget. | CListView |
baseScriptUrl | string | the base script URL for all list view resources (e. | CListView |
beforeAjaxUpdate | string | a javascript function that will be invoked before an AJAX update occurs. | CListView |
controller | CController | Returns the controller that this widget belongs to. | CWidget |
cssFile | string | the URL of the CSS file used by this list view. | CListView |
dataProvider | CActiveDataProvider | the data provider for the view. | SortableCListView |
descSort | boolean | whether to show records in a descendant order. | SortableCListView |
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 | Returns the ID of the widget or generates a new one if requested. | CWidget |
itemView | string | the view used for rendering each data item. | CListView |
itemsCssClass | string | the CSS class name for the container of all data item display. | CBaseListView |
itemsTagName | string | the HTML tag name for the container of all data item display. | CListView |
listSorted | boolean | whether to list items sorted, which is the essence of this widget. | SortableCListView |
loadingCssClass | string | the CSS class name that will be assigned to the widget container element when the widget is updating its content via AJAX. | CListView |
orderField | string | the field name in the database table which stores the order for the record. | SortableCListView |
owner | CBaseController | Returns the 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 |
separator | string | the HTML code to be displayed between any two consecutive items. | CListView |
skin | mixed | the name of the skin to be used by this widget. | CWidget |
sortableAttributes | array | list of sortable attribute names. | CListView |
sorterCssClass | string | the CSS class name for the sorter container. | CListView |
sorterFooter | string | the text shown after sort links. | CListView |
sorterHeader | string | the text shown before sort links. | CListView |
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 components in the list view. | CListView |
updateSelector | string | the jQuery selector of the HTML elements that may trigger AJAX updates when they are clicked. | CListView |
viewData | array | additional data to be passed to itemView when rendering each data item. | CListView |
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() | Returns the controller that this widget belongs to. | CWidget |
getEventHandlers() | Returns the list of attached event handlers for an event. | CComponent |
getId() | Returns the ID of the widget or generates a new one if requested. | CWidget |
getOwner() | Returns the owner/creator of this widget. | 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 list view. | SortableCListView |
raiseEvent() | Raises an event. | CComponent |
registerClientScript() | Registers necessary client scripts. | CListView |
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 item list. | CListView |
renderKeys() | Renders the key values of the data in a hidden tag. | CBaseListView |
renderPager() | Renders the pager. | CBaseListView |
renderSorter() | Renders the sorter. | CListView |
renderSummary() | Renders the summary text. | CBaseListView |
run() | Renders the view. | CBaseListView |
setId() | Sets the ID of the widget. | CWidget |
widget() | Creates a widget and executes it. | CBaseController |
Protected Methods
Method | Description | Defined By |
---|---|---|
renderSection() | Renders a section. | CBaseListView |
Property Details
dataProvider
property
public CActiveDataProvider $dataProvider;
the data provider for the view.
descSort
property
public boolean $descSort;
whether to show records in a descendant order. Defaults to false
listSorted
property
public boolean $listSorted;
whether to list items sorted, which is the essence of this widget. If it's set to true items are listed ordered by the field defined in $orderField. It it's set to false the widget defaults to a normal CListView and the rest of this extension widget properties are ignored. Defaults to true
orderField
property
public string $orderField;
the field name in the database table which stores the order for the record. This should be a positive integer field. Defaults to 'order'
Method Details
init()
method
public void init()
|
Source Code: extensions//widgets/SortableCListView.php#L54 (show)
public function init()
{
if ($this->listSorted === true)
{
/*To use this widget, data provider must be an instance of CActiveDataProvider*/
if (!($this->dataProvider instanceof CActiveDataProvider)) {
throw new CException(Yii::t('zii', 'Data provider must be an instance of CActiveDataProvider'));
}
if ($this->descSort !== true) {
$sort_direction = 'ASC';
} else {
$sort_direction = 'DESC';
}
$this->dataProvider->setSort(array('defaultOrder' => '`'.$this->orderField.'`'.$sort_direction));
}
parent::init();
}
Initializes the list view. This method will initialize required property values and instantiate columns objects.