PHP 클래스 Prado\Web\UI\WebControls\TListControl

TListControl is a base class for list controls, such as {@link TListBox}, {@link TDropDownList}, {@link TCheckBoxList}, etc. It manages the items and their status in a list control. It also implements how the items can be populated from template and data source. The property {@link getItems} returns a list of the items in the control. To specify or determine which item is selected, use the {@link getSelectedIndex SelectedIndex} property that indicates the zero-based index of the selected item in the item list. You may also use {@link getSelectedItem SelectedItem} and {@link getSelectedValue SelectedValue} to get the selected item and its value. For multiple selection lists (such as {@link TCheckBoxList} and {@link TListBox}), property {@link getSelectedIndices SelectedIndices} is useful. TListControl implements {@link setAutoPostBack AutoPostBack} which allows a list control to postback the page if the selections of the list items are changed. The {@link setCausesValidation CausesValidation} and {@link setValidationGroup ValidationGroup} properties may be used to specify that validation be performed when auto postback occurs. There are three ways to populate the items in a list control: from template, using {@link setDataSource DataSource} and using {@link setDataSourceID DataSourceID}. The latter two are covered in {@link TDataBoundControl}. To specify items via template, using the following template syntax: When {@link setDataSource DataSource} or {@link setDataSourceID DataSourceID} is used to populate list items, the {@link setDataTextField DataTextField} and {@link setDataValueField DataValueField} properties are used to specify which columns of the data will be used to populate the text and value of the items. For example, if a data source is as follows, $dataSource=array( array('name'=>'John', 'age'=>31), array('name'=>'Cary', 'age'=>28), array('name'=>'Rose', 'age'=>35), ); setting {@link setDataTextField DataTextField} and {@link setDataValueField DataValueField} to 'name' and 'age' will make the first item's text be 'John', value be 31, the second item's text be 'Cary', value be 28, and so on. The {@link setDataTextFormatString DataTextFormatString} property may be further used to format how the item should be displayed. See {@link formatDataValue()} for an explanation of the format string. The {@link setPromptText PromptText} and {@link setPromptValue PromptValue} properties can be used to add a dummy list item that will be rendered first.
부터: 3.0
저자: Qiang Xue ([email protected])
상속: extends TDataBoundControl, implements Prado\IDataRenderer
파일 보기 프로젝트 열기: pradosoft/prado 1 사용 예제들

공개 메소드들

메소드 설명
addParsedObject ( $object ) Adds object parsed from template to the control.
clearSelection ( ) Clears all existing selections.
getAppendDataBoundItems ( ) : boolean
getAutoPostBack ( ) : boolean
getCausesValidation ( ) : boolean
getData ( ) : string Returns the value of the selected item with the lowest cardinal index.
getDataGroupField ( ) : string
getDataTextField ( ) : string
getDataTextFormatString ( ) : string
getDataValueField ( ) : string
getEnableClientScript ( ) : boolean
getHasItems ( ) : boolean
getItemCount ( ) : integer
getItems ( ) : TListItemCollection
getPromptText ( ) : string
getPromptValue ( ) : string
getSelectedIndex ( ) : integer
getSelectedIndices ( ) : array
getSelectedItem ( ) : TListItem | null
getSelectedValue ( ) : string
getSelectedValues ( ) : array
getText ( ) : string
getValidationGroup ( ) : string
loadState ( ) Loads items from viewstate.
onSelectedIndexChanged ( $param ) Raises OnSelectedIndexChanged event when selection is changed.
onTextChanged ( $param ) Raises OnTextChanged event when selection is changed.
renderContents ( $writer ) Renders body content of the list control.
saveState ( ) Saves items into viewstate.
setAppendDataBoundItems ( $value )
setAutoPostBack ( $value ) Sets the value indicating if postback automatically.
setCausesValidation ( $value )
setData ( $value ) Selects an item by the specified value.
setDataGroupField ( $value )
setDataTextField ( $value )
setDataTextFormatString ( $value ) Sets data text format string.
setDataValueField ( $value )
setEnableClientScript ( $value )
setPromptText ( $value )
setPromptValue ( $value )
setSelectedIndex ( $index )
setSelectedIndices ( $indices )
setSelectedValue ( $value ) Sets selection by item value.
setSelectedValues ( $values )
setText ( $value )
setValidationGroup ( $value )

보호된 메소드들

메소드 설명
addAttributesToRender ( $writer ) Adds attributes to renderer.
createListItemCollection ( ) : TListItemCollection Creates a collection object to hold list items.
formatDataValue ( $formatString, $value ) : string Formats the text value according to a format string.
getClientClassName ( ) : string Gets the name of the javascript class responsible for performing postback for this control.
getIsMultiSelect ( ) : boolean
getPostBackOptions ( ) : array
getTagName ( ) : string
performDataBinding ( $data ) Performs databinding to populate list items from data source.
renderClientControlScript ( $writer ) Renders the javascript for list control.
renderPrompt ( $writer ) Renders the prompt text, if any.

비공개 메소드들

메소드 설명
resetCachedSelections ( )

메소드 상세

addAttributesToRender() 보호된 메소드

Adds attributes to renderer.
protected addAttributesToRender ( $writer )

addParsedObject() 공개 메소드

This method adds only {@link TListItem} objects into the {@link getItems Items} collection. All other objects are ignored.
public addParsedObject ( $object )

clearSelection() 공개 메소드

Clears all existing selections.
public clearSelection ( )

createListItemCollection() 보호된 메소드

This method may be overriden to create a customized collection.
protected createListItemCollection ( ) : TListItemCollection
리턴 TListItemCollection the collection object

formatDataValue() 보호된 메소드

If the format string is empty, the original value is converted into a string and returned. If the format string starts with '#', the string is treated as a PHP expression within which the token '{0}' is translated with the data value to be formated. Otherwise, the format string and the data value are passed as the first and second parameters in {@link sprintf}.
protected formatDataValue ( $formatString, $value ) : string
리턴 string the formatted result

getAppendDataBoundItems() 공개 메소드

public getAppendDataBoundItems ( ) : boolean
리턴 boolean whether performing databind should append items or clear the existing ones. Defaults to false.

getAutoPostBack() 공개 메소드

public getAutoPostBack ( ) : boolean
리턴 boolean a value indicating whether an automatic postback to the server will occur whenever the user makes change to the list control and then tabs out of it. Defaults to false.

getCausesValidation() 공개 메소드

public getCausesValidation ( ) : boolean
리턴 boolean whether postback event trigger by this list control will cause input validation, default is true.

getClientClassName() 보호된 메소드

Derived classes may override this method and return customized js class names.
protected getClientClassName ( ) : string
리턴 string the javascript class name

getData() 공개 메소드

This method is required by {@link \Prado\IDataRenderer}. It is the same as {@link getSelectedValue()}.
또한 보기: getSelectedValue
부터: 3.1.0
public getData ( ) : string
리턴 string the value of the selected item with the lowest cardinal index, empty if no selection.

getDataGroupField() 공개 메소드

public getDataGroupField ( ) : string
리턴 string the field of the data source that provides the label of the list item groups

getDataTextField() 공개 메소드

public getDataTextField ( ) : string
리턴 string the field of the data source that provides the text content of the list items.

getDataTextFormatString() 공개 메소드

public getDataTextFormatString ( ) : string
리턴 string the formatting string used to control how data bound to the list control is displayed.

getDataValueField() 공개 메소드

public getDataValueField ( ) : string
리턴 string the field of the data source that provides the value of each list item.

getEnableClientScript() 공개 메소드

public getEnableClientScript ( ) : boolean
리턴 boolean whether to render javascript.

getHasItems() 공개 메소드

public getHasItems ( ) : boolean
리턴 boolean whether the list control contains any items.

getIsMultiSelect() 보호된 메소드

protected getIsMultiSelect ( ) : boolean
리턴 boolean whether this is a multiselect control. Defaults to false.

getItemCount() 공개 메소드

public getItemCount ( ) : integer
리턴 integer the number of items in the list control

getItems() 공개 메소드

public getItems ( ) : TListItemCollection
리턴 TListItemCollection the item collection

getPostBackOptions() 보호된 메소드

protected getPostBackOptions ( ) : array
리턴 array postback options for JS postback code

getPromptText() 공개 메소드

부터: 3.1.1
public getPromptText ( ) : string
리턴 string the prompt text which is to be displayed as the first list item.

getPromptValue() 공개 메소드

또한 보기: getPromptText
부터: 3.1.1
public getPromptValue ( ) : string
리턴 string the prompt selection value.

getSelectedIndex() 공개 메소드

public getSelectedIndex ( ) : integer
리턴 integer the index (zero-based) of the item being selected, -1 if no item is selected.

getSelectedIndices() 공개 메소드

public getSelectedIndices ( ) : array
리턴 array list of index of items that are selected

getSelectedItem() 공개 메소드

public getSelectedItem ( ) : TListItem | null
리턴 TListItem | null the selected item with the lowest cardinal index, null if no item is selected.

getSelectedValue() 공개 메소드

public getSelectedValue ( ) : string
리턴 string the value of the selected item with the lowest cardinal index, empty if no selection

getSelectedValues() 공개 메소드

public getSelectedValues ( ) : array
리턴 array list of the selected item values (strings)

getTagName() 보호된 메소드

protected getTagName ( ) : string
리턴 string tag name of the list control

getText() 공개 메소드

public getText ( ) : string
리턴 string selected value

getValidationGroup() 공개 메소드

public getValidationGroup ( ) : string
리턴 string the group of validators which the list control causes validation upon postback

loadState() 공개 메소드

This method is invoked right after control state is loaded.
public loadState ( )

onSelectedIndexChanged() 공개 메소드

This method is invoked when the list control has its selection changed by end-users.
public onSelectedIndexChanged ( $param )

onTextChanged() 공개 메소드

This method is invoked when the list control has its selection changed by end-users.
public onTextChanged ( $param )

performDataBinding() 보호된 메소드

This method is invoked by dataBind(). You may override this function to provide your own way of data population.
protected performDataBinding ( $data )

renderClientControlScript() 보호된 메소드

Renders the javascript for list control.
protected renderClientControlScript ( $writer )

renderContents() 공개 메소드

This method renders items contained in the list control as the body content.
public renderContents ( $writer )

renderPrompt() 보호된 메소드

Renders the prompt text, if any.
부터: 3.1.1
protected renderPrompt ( $writer )

saveState() 공개 메소드

This method is invoked right before control state is to be saved.
public saveState ( )

setAppendDataBoundItems() 공개 메소드

public setAppendDataBoundItems ( $value )

setAutoPostBack() 공개 메소드

An automatic postback to the server will occur whenever the user makes change to the list control and then tabs out of it.
public setAutoPostBack ( $value )

setCausesValidation() 공개 메소드

public setCausesValidation ( $value )

setData() 공개 메소드

This method is required by {@link \Prado\IDataRenderer}. It is the same as {@link setSelectedValue()}.
또한 보기: setSelectedValue
부터: 3.1.0
public setData ( $value )

setDataGroupField() 공개 메소드

public setDataGroupField ( $value )

setDataTextField() 공개 메소드

public setDataTextField ( $value )

setDataTextFormatString() 공개 메소드

The format string is used in {@link TDataValueFormatter::format()} to format the Text property value of each item in the list control.
또한 보기: TDataValueFormatter::format()
public setDataTextFormatString ( $value )

setDataValueField() 공개 메소드

public setDataValueField ( $value )

setEnableClientScript() 공개 메소드

public setEnableClientScript ( $value )

setPromptText() 공개 메소드

부터: 3.1.1
public setPromptText ( $value )

setPromptValue() 공개 메소드

또한 보기: setPromptText
부터: 3.1.1
public setPromptValue ( $value )

setSelectedIndex() 공개 메소드

public setSelectedIndex ( $index )

setSelectedIndices() 공개 메소드

public setSelectedIndices ( $indices )

setSelectedValue() 공개 메소드

Existing selections will be cleared if the item value is found in the item collection. Note, if the value is null, existing selections will also be cleared.
public setSelectedValue ( $value )

setSelectedValues() 공개 메소드

public setSelectedValues ( $values )

setText() 공개 메소드

public setText ( $value )

setValidationGroup() 공개 메소드

public setValidationGroup ( $value )