Index

Classes

  • TAPCCache
  • TApplicationStateCacheDependency
  • TCache
  • TCacheDependency
  • TCacheDependencyList
  • TChainedCacheDependency
  • TDbCache
  • TDirectoryCacheDependency
  • TEtcdCache
  • TFileCacheDependency
  • TGlobalStateCacheDependency
  • TMemCache
  • TRedisCache
  • TArraySubscription
  • TAttributeCollection
  • TCollectionSubscription
  • TDummyDataSource
  • TDummyDataSourceIterator
  • TList
  • TListItemCollection
  • TMap
  • TPagedDataSource
  • TPagedList
  • TPagedListFetchDataEventParameter
  • TPagedListIterator
  • TPagedListPageChangedEventParameter
  • TPagedMapIterator
  • TPriorityList
  • TPriorityMap
  • TQueue
  • TQueueIterator
  • TStack
  • TWeakCallableCollection
  • TWeakList
  • TActiveRecordConfigurationException
  • TActiveRecordException
  • TActiveRecordBelongsTo
  • TActiveRecordHasMany
  • TActiveRecordHasManyAssociation
  • TActiveRecordHasOne
  • TActiveRecordRelation
  • TActiveRecordRelationContext
  • TIbmScaffoldInput
  • TMssqlScaffoldInput
  • TMysqlScaffoldInput
  • TPgsqlScaffoldInput
  • TScaffoldInputBase
  • TScaffoldInputCommon
  • TSqliteScaffoldInput
  • TScaffoldBase
  • TScaffoldEditView
  • TScaffoldListView
  • TScaffoldSearch
  • TScaffoldView
  • TActiveRecord
  • TActiveRecordChangeEventParameter
  • TActiveRecordConfig
  • TActiveRecordCriteria
  • TActiveRecordGateway
  • TActiveRecordInvalidFinderResult
  • TActiveRecordManager
  • TMssqlCommandBuilder
  • TMssqlMetaData
  • TMssqlTableColumn
  • TMssqlTableInfo
  • TMysqlCommandBuilder
  • TMysqlMetaData
  • TMysqlTableColumn
  • TMysqlTableInfo
  • TOracleCommandBuilder
  • TOracleMetaData
  • TOracleTableColumn
  • TOracleTableInfo
  • TPgsqlCommandBuilder
  • TPgsqlMetaData
  • TPgsqlTableColumn
  • TPgsqlTableInfo
  • TSqliteCommandBuilder
  • TSqliteMetaData
  • TSqliteTableColumn
  • TSqliteTableInfo
  • TDbCommandBuilder
  • TDbMetaData
  • TDbTableColumn
  • TDbTableInfo
  • TDataGatewayCommand
  • TDataGatewayEventParameter
  • TDataGatewayResultEventParameter
  • TSqlCriteria
  • TTableGateway
  • TDiscriminator
  • TInlineParameterMapParser
  • TParameterMap
  • TParameterProperty
  • TResultMap
  • TResultProperty
  • TSimpleDynamicParser
  • TSqlMapCacheKey
  • TSqlMapCacheModel
  • TSqlMapCacheTypes
  • TSqlMapDelete
  • TSqlMapInsert
  • TSqlMapSelect
  • TSqlMapSelectKey
  • TSqlMapStatement
  • TSqlMapUpdate
  • TSqlMapXmlConfigBuilder
  • TSqlMapXmlConfiguration
  • TSqlMapXmlMappingConfiguration
  • TSubMap
  • TInvalidPropertyException
  • TLazyLoadList
  • TObjectProxy
  • TPropertyAccess
  • TSqlMapApplicationCache
  • TSqlMapCache
  • TSqlMapConfigurationException
  • TSqlMapDuplicateException
  • TSqlMapException
  • TSqlMapExecutionException
  • TSqlMapFifoCache
  • TSqlMapLruCache
  • TSqlMapPagedList
  • TSqlMapTypeHandler
  • TSqlMapTypeHandlerRegistry
  • TSqlMapUndefinedException
  • TCachingStatement
  • TDeleteMappedStatement
  • TInsertMappedStatement
  • TMappedStatement
  • TPostSelectBinding
  • TPreparedCommand
  • TPreparedStatement
  • TPreparedStatementFactory
  • TResultSetListItemParameter
  • TResultSetMapItemParameter
  • TSelectMappedStatement
  • TSimpleDynamicSql
  • TSqlMapObjectCollectionTree
  • TStaticSql
  • TUpdateMappedStatement
  • TSqlMapConfig
  • TSqlMapGateway
  • TSqlMapManager
  • TDataSourceConfig
  • TDbColumnCaseMode
  • TDbCommand
  • TDbConnection
  • TDbDataReader
  • TDbNullConversionMode
  • TDbTransaction
  • TApplicationException
  • TConfigurationException
  • TDbConnectionException
  • TDbException
  • TErrorHandler
  • TException
  • TExitException
  • THttpException
  • TInvalidDataTypeException
  • TInvalidDataValueException
  • TInvalidOperationException
  • TIOException
  • TLogException
  • TNetworkException
  • TNotSupportedException
  • TPhpErrorException
  • TPhpFatalErrorException
  • TSocketException
  • TSystemException
  • TTemplateException
  • TUnknownMethodException
  • TUserException
  • ChoiceFormat
  • CultureInfo
  • TGettext
  • TGettext_MO
  • TGettext_PO
  • MessageCache
  • MessageFormat
  • MessageSource
  • MessageSource_Database
  • MessageSource_gettext
  • MessageSource_PHP
  • MessageSource_XLIFF
  • TCache_Lite
  • TMessageSourceIOException
  • TChoiceFormat
  • TDateFormat
  • TGlobalization
  • TGlobalizationAutoDetect
  • TI18NControl
  • TNumberFormat
  • Translation
  • TTranslate
  • TTranslateParameter
  • TOutputWriter
  • TStdOutWriter
  • TStreamNotificationCallback
  • TStreamNotificationParameter
  • TTarFileExtractor
  • TTextWriter
  • DynamicMethodReflection
  • DynamicMethodsClassReflectionExtension
  • Prado
  • TPermissionEvent
  • TPermissionsAction
  • TPermissionsBehavior
  • TPermissionsConfigurationBehavior
  • TPermissionsManager
  • TUserOwnerRule
  • TUserPermissionsBehavior
  • TAuthManager
  • TAuthorizationRule
  • TAuthorizationRuleCollection
  • TDbUser
  • TDbUserManager
  • TSecurityManager
  • TUser
  • TUserManager
  • TUserManagerPasswordMode
  • TActiveRecordAction
  • TDbParameterAction
  • TFlushCachesAction
  • THelpAction
  • TPhpShellAction
  • TWebServerAction
  • TShellAction
  • TShellApplication
  • TShellLoginBehavior
  • TShellWriter
  • TApplication
  • TApplicationComponent
  • TApplicationConfiguration
  • TApplicationMode
  • TApplicationStatePersister
  • TComponent
  • TComponentReflection
  • TEnumerable
  • TEventHandler
  • TEventParameter
  • TEventResults
  • TEventSubscription
  • TModule
  • TPropertyValue
  • TService
  • TApplicationSignals
  • TBehaviorParameterLoader
  • TCaptureForkLog
  • TForkable
  • TGlobalClassAware
  • TMapLazyLoadBehavior
  • TMapRouteBehavior
  • TPageGlobalizationCharsetBehavior
  • TPageNoCacheBehavior
  • TPageTopAnchorBehavior
  • TParameterizeBehavior
  • TTimeZoneParameterBehavior
  • TCronMethodTask
  • TCronModule
  • TCronTask
  • TCronTaskInfo
  • TDbCronCleanLogTask
  • TDbCronModule
  • TShellCronAction
  • TShellCronLogBehavior
  • TShellDbCronAction
  • TTimeScheduler
  • TArrayHelper
  • TBitHelper
  • TEscCharsetConverter
  • TProcessHelper
  • TProcessWindowsPriority
  • TProcessWindowsPriorityName
  • TRational
  • TURational
  • TBaseBehavior
  • TBehavior
  • TBehaviorsModule
  • TBrowserLogRoute
  • TCallChain
  • TClassBehavior
  • TClassBehaviorEventParameter
  • TDataFieldAccessor
  • TDbLogRoute
  • TDbParameterModule
  • TDbPluginModule
  • TEmailLogRoute
  • TFileLogRoute
  • TFirebugLogRoute
  • TFirePhpLogRoute
  • TJsonRpcClient
  • TLogger
  • TLogRoute
  • TLogRouter
  • TParameterModule
  • TPluginModule
  • TRpcClient
  • TRpcClientRequestException
  • TRpcClientResponseException
  • TRpcClientTypesEnumerable
  • TSignalParameter
  • TSignalsDispatcher
  • TSimpleDateFormatter
  • TStdOutLogRoute
  • TSysLogRoute
  • TUtf8Converter
  • TVarDumper
  • TXmlRpcClient
  • TRequestConnectionUpgrade
  • TJavaScript
  • TJavaScriptAsset
  • TJavaScriptLiteral
  • TJavaScriptString
  • TFeedService
  • TJsonResponse
  • TJsonRpcProtocol
  • TJsonService
  • TPageConfiguration
  • TPageService
  • TRpcApiProvider
  • TRpcException
  • TRpcProtocol
  • TRpcServer
  • TRpcService
  • TSoapServer
  • TSoapService
  • TXmlRpcProtocol
  • TAssetManager
  • TCacheHttpSession
  • THttpCookie
  • THttpCookieCollection
  • THttpCookieSameSite
  • THttpRequest
  • THttpRequestParameter
  • THttpRequestResolveMethod
  • THttpRequestUrlFormat
  • THttpResponse
  • THttpResponseAdapter
  • THttpSession
  • THttpSessionCookieMode
  • THttpUtility
  • TSessionIterator
  • TUri
  • TUrlManager
  • TUrlMapping
  • TUrlMappingPattern
  • TUrlMappingPatternSecureConnection
  • TActiveBoundColumn
  • TActiveButton
  • TActiveButtonColumn
  • TActiveCheckBox
  • TActiveCheckBoxColumn
  • TActiveCheckBoxList
  • TActiveCheckBoxListItem
  • TActiveClientScript
  • TActiveControlAdapter
  • TActiveCustomValidator
  • TActiveCustomValidatorClientSide
  • TActiveDataGrid
  • TActiveDataGridPager
  • TActiveDataGridPagerEventParameter
  • TActiveDataList
  • TActiveDatePicker
  • TActiveDatePickerClientScript
  • TActiveDropDownList
  • TActiveDropDownListColumn
  • TActiveEditCommandColumn
  • TActiveFileUpload
  • TActiveFileUploadCallbackParams
  • TActiveFileUploadItem
  • TActiveHiddenField
  • TActiveHtmlArea
  • TActiveHtmlArea5
  • TActiveHyperLink
  • TActiveHyperLinkColumn
  • TActiveImage
  • TActiveImageButton
  • TActiveLabel
  • TActiveLinkButton
  • TActiveListBox
  • TActiveListControlAdapter
  • TActiveListItemCollection
  • TActiveLiteralColumn
  • TActiveMultiView
  • TActivePageAdapter
  • TActivePager
  • TActivePanel
  • TActiveRadioButton
  • TActiveRadioButtonItem
  • TActiveRadioButtonList
  • TActiveRatingList
  • TActiveRepeater
  • TActiveTableCell
  • TActiveTableCellEventParameter
  • TActiveTableRow
  • TActiveTableRowEventParameter
  • TActiveTemplateColumn
  • TActiveTextBox
  • TBaseActiveCallbackControl
  • TBaseActiveControl
  • TCallback
  • TCallbackClientScript
  • TCallbackClientSide
  • TCallbackErrorHandler
  • TCallbackEventParameter
  • TCallbackOptions
  • TCallbackPageStateTracker
  • TCallbackResponseAdapter
  • TCallbackResponseWriter
  • TEventTriggeredCallback
  • TInPlaceTextBox
  • TInvalidCallbackException
  • TMapCollectionDiff
  • TScalarDiff
  • TStyleDiff
  • TTimeTriggeredCallback
  • TTriggeredCallback
  • TValueTriggeredCallback
  • TViewStateDiff
  • TJuiAutoComplete
  • TJuiAutoCompleteEventParameter
  • TJuiAutoCompleteTemplate
  • TJuiCallbackPageStateTracker
  • TJuiControlAdapter
  • TJuiControlOptions
  • TJuiDatePicker
  • TJuiDialog
  • TJuiDialogButton
  • TJuiDraggable
  • TJuiDroppable
  • TJuiEventParameter
  • TJuiProgressbar
  • TJuiResizable
  • TJuiSelectable
  • TJuiSelectableTemplate
  • TJuiSlider
  • TJuiSortable
  • TJuiSortableTemplate
  • TBroadcastEventParameter
  • TCachePageStatePersister
  • TClientScriptManager
  • TClientSideOptions
  • TCommandEventParameter
  • TCompositeControl
  • TCompositeLiteral
  • TControl
  • TControlAdapter
  • TControlCollection
  • TEmptyControlCollection
  • TEventContent
  • TForm
  • THtmlWriter
  • TPage
  • TPageStateFormatter
  • TPageStatePersister
  • TSessionPageStatePersister
  • TSkinTemplate
  • TTemplate
  • TTemplateControl
  • TTemplateControlInheritable
  • TTemplateManager
  • TTheme
  • TThemeManager
  • TWebColors
  • TAccordion
  • TAccordionView
  • TAccordionViewCollection
  • TBaseDataList
  • TBaseValidator
  • TBoundColumn
  • TBulletedList
  • TBulletedListDisplayMode
  • TBulletedListEventParameter
  • TBulletStyle
  • TButton
  • TButtonColumn
  • TButtonColumnType
  • TButtonTag
  • TButtonType
  • TCaptcha
  • TCaptchaValidator
  • TCheckBox
  • TCheckBoxColumn
  • TCheckBoxItem
  • TCheckBoxList
  • TCircleHotSpot
  • TClientScript
  • TClientSideValidationSummaryOptions
  • TColorPicker
  • TColorPickerClientSide
  • TColorPickerMode
  • TCompareValidator
  • TCompleteWizardStep
  • TConditional
  • TContent
  • TContentDirection
  • TContentPlaceHolder
  • TCustomValidator
  • TDataBoundControl
  • TDataGrid
  • TDataGridColumn
  • TDataGridColumnCollection
  • TDataGridCommandEventParameter
  • TDataGridItem
  • TDataGridItemCollection
  • TDataGridItemEventParameter
  • TDataGridItemRenderer
  • TDataGridPageChangedEventParameter
  • TDataGridPager
  • TDataGridPagerButtonType
  • TDataGridPagerEventParameter
  • TDataGridPagerMode
  • TDataGridPagerPosition
  • TDataGridPagerStyle
  • TDataGridSortCommandEventParameter
  • TDataList
  • TDataListCommandEventParameter
  • TDataListItem
  • TDataListItemCollection
  • TDataListItemEventParameter
  • TDataListItemRenderer
  • TDataRenderer
  • TDataSize
  • TDataSourceControl
  • TDataSourceSelectParameters
  • TDataSourceView
  • TDataTypeValidator
  • TDatePicker
  • TDatePickerClientScript
  • TDatePickerInputMode
  • TDatePickerMode
  • TDatePickerPositionMode
  • TDisplayStyle
  • TDropDownList
  • TDropDownListColumn
  • TEditCommandColumn
  • TEmailAddressValidator
  • TExpression
  • TFileUpload
  • TFileUploadItem
  • TFlushOutput
  • TFont
  • TGravatar
  • THead
  • THeader1
  • THeader2
  • THeader3
  • THeader4
  • THeader5
  • THeader6
  • THiddenField
  • THorizontalAlign
  • THotSpot
  • THotSpotCollection
  • THotSpotMode
  • THtmlArea
  • THtmlArea5
  • THtmlElement
  • THyperLink
  • THyperLinkColumn
  • TImage
  • TImageButton
  • TImageClickEventParameter
  • TImageMap
  • TImageMapEventParameter
  • TInlineFrame
  • TInlineFrameAlign
  • TInlineFrameScrollBars
  • TItemDataRenderer
  • TJavascriptLogger
  • TKeyboard
  • TLabel
  • TLinkButton
  • TListBox
  • TListControl
  • TListControlValidator
  • TListItem
  • TListItemType
  • TListSelectionMode
  • TLiteral
  • TLiteralColumn
  • TMarkdown
  • TMetaTag
  • TMetaTagCollection
  • TMultiView
  • TOutputCache
  • TOutputCacheCalculateKeyEventParameter
  • TOutputCacheCheckDependencyEventParameter
  • TOutputCacheTextWriterMulti
  • TPageLoadTime
  • TPager
  • TPagerButtonType
  • TPagerMode
  • TPagerPageChangedEventParameter
  • TPanel
  • TPanelStyle
  • TPlaceHolder
  • TPolygonHotSpot
  • TRadioButton
  • TRadioButtonItem
  • TRadioButtonList
  • TRangeValidationDataType
  • TRangeValidator
  • TRatingList
  • TReadOnlyDataSource
  • TReadOnlyDataSourceView
  • TReCaptcha
  • TReCaptcha2
  • TReCaptcha2Validator
  • TReCaptchaValidator
  • TRectangleHotSpot
  • TRegularExpressionValidator
  • TRepeatDirection
  • TRepeater
  • TRepeaterCommandEventParameter
  • TRepeaterItem
  • TRepeaterItemCollection
  • TRepeaterItemEventParameter
  • TRepeaterItemRenderer
  • TRepeatInfo
  • TRepeatLayout
  • TRequiredFieldValidator
  • TSafeHtml
  • TScrollBars
  • TServerValidateEventParameter
  • TSlider
  • TSliderClientScript
  • TSliderDirection
  • TStatements
  • TStyle
  • TStyleSheet
  • TTable
  • TTableCaptionAlign
  • TTableCell
  • TTableCellCollection
  • TTableFooterRow
  • TTableGridLines
  • TTableHeaderCell
  • TTableHeaderRow
  • TTableHeaderScope
  • TTableItemStyle
  • TTableRow
  • TTableRowCollection
  • TTableRowSection
  • TTableStyle
  • TTabPanel
  • TTabView
  • TTabViewCollection
  • TTemplateColumn
  • TTemplatedWizardStep
  • TTextAlign
  • TTextBox
  • TTextBoxAutoCompleteType
  • TTextBoxMode
  • TTextHighlighter
  • TTextProcessor
  • TValidationCompareOperator
  • TValidationDataType
  • TValidationSummary
  • TValidationSummaryDisplayMode
  • TValidationSummaryDisplayStyle
  • TValidatorClientSide
  • TValidatorDisplayStyle
  • TVerticalAlign
  • TView
  • TViewCollection
  • TWebControl
  • TWebControlAdapter
  • TWebControlDecorator
  • TWizard
  • TWizardFinishNavigationTemplate
  • TWizardNavigationButtonStyle
  • TWizardNavigationButtonType
  • TWizardNavigationContainer
  • TWizardNavigationEventParameter
  • TWizardNavigationTemplate
  • TWizardSideBarListItemTemplate
  • TWizardSideBarTemplate
  • TWizardStartNavigationTemplate
  • TWizardStep
  • TWizardStepCollection
  • TWizardStepNavigationTemplate
  • TWizardStepType
  • TXmlTransform
  • TXmlDocument
  • TXmlElement
  • TXmlElementList

Interfaces

  • ICache
  • ICacheDependency
  • ICollectionFilter
  • IPriorityCapture
  • IPriorityCollection
  • IPriorityItem
  • IPriorityProperty
  • IWeakCollection
  • IWeakRetainable
  • IScaffoldEditRenderer
  • IMappedStatement
  • IMessageSource
  • IDataRenderer
  • IEventParameter
  • IModule
  • ITextWriter
  • IService
  • ISingleton
  • IStatePersister
  • IUser
  • IUserManager
  • IPermissions
  • IBaseBehavior
  • IBehavior
  • IClassBehavior
  • IDbModule
  • IDynamicMethods
  • IInstanceCheck
  • IOutputLogRoute
  • IPluginModule
  • IFeedContentProvider
  • IActiveControl
  • ICallbackEventHandler
  • IBindable
  • IBroadcastEventReceiver
  • IButtonControl
  • INamingContainer
  • IPageStatePersister
  • IPostBackDataHandler
  • IPostBackEventHandler
  • IRenderable
  • ISurroundable
  • ITemplate
  • ITheme
  • IValidatable
  • IValidator
  • IJuiOptions
  • IDataSource
  • IItemDataRenderer
  • IListControlAdapter
  • IRepeatInfoUser
  • IStyleable

Traits

  • TPriorityCollectionTrait
  • TPriorityPropertyTrait
  • TWeakCollectionTrait
  • TPermissionsManagerPropertyTrait
  • TNoUnserializeBehaviorTrait
  • TNoUnserializeClassBehaviorTrait

Search results

    • Namespaces
    • Errors
    • Deprecated
    • Markers

    Class \Prado\Web\UI\WebControls\TDataGrid

    TDataGrid class

    TDataGrid represents a data bound and updatable grid control.

    To populate data into the datagrid, sets its \Prado\Web\UI\WebControls\setDataSource to a tabular data source and call dataBind(). Each row of data will be represented by an item in the \Prado\Web\UI\WebControls\getItems collection of the datagrid.

    An item can be at one of three states: browsing, selected and edit. The state determines how the item will be displayed. For example, if an item is in edit state, it may be displayed as a table row with input text boxes if the columns are of type TBoundColumn; and if in browsing state, they are displayed as static text.

    To change the state of an item, set \Prado\Web\UI\WebControls\setEditItemIndex or \Prado\Web\UI\WebControls\setSelectedItemIndex property.

    Each datagrid item has a \Prado\Web\UI\WebControls\TDataGridItem::getItemType which tells the position and state of the item in the datalist. An item in the header of the repeater is of type Header. A body item may be of either Item, AlternatingItem, SelectedItem or EditItem, depending whether the item index is odd or even, whether it is being selected or edited.

    A datagrid is specified with a list of columns. Each column specifies how the corresponding table column will be displayed. For example, the header/footer text of that column, the cells in that column, and so on. The following column types are currently provided by the framework,

    • TBoundColumn, associated with a specific field in datasource and displays the corresponding data.
    • TEditCommandColumn, displaying edit/update/cancel command buttons
    • TButtonColumn, displaying generic command buttons that may be bound to specific field in datasource.
    • TDropDownListColumn, displaying a dropdown list when the item is in edit state
    • THyperLinkColumn, displaying a hyperlink that may be bound to specific field in datasource.
    • TCheckBoxColumn, displaying a checkbox that may be bound to specific field in datasource.
    • TTemplateColumn, displaying content based on templates.

    There are three ways to specify columns for a datagrid.

    • Automatically generated based on data source. By setting \Prado\Web\UI\WebControls\setAutoGenerateColumns to true, a list of columns will be automatically generated based on the schema of the data source. Each column corresponds to a column of the data.
    • Specified in template. For example, ```php ```
    • Manually created in code. Columns can be manipulated via the \Prado\Web\UI\WebControls\setColumns property of the datagrid. For example, ```php $column=new TBoundColumn; $datagrid->Columns[]=$column; ```
    Note, automatically generated columns cannot be accessed via the \Prado\Web\UI\WebControls\getColumns property.

    TDataGrid supports sorting. If the \Prado\Web\UI\WebControls\setAllowSorting is set to true, a column with nonempty \Prado\Web\UI\WebControls\setSortExpression will have its header text displayed as a clickable link button. Clicking on the link button will raise \Prado\Web\UI\WebControls\onSortCommand event. You can respond to this event, sort the data source according to the event parameter, and then invoke databind() on the datagrid to show to end users the sorted data.

    TDataGrid supports paging. If the \Prado\Web\UI\WebControls\setAllowPaging is set to true, a pager will be displayed on top and/or bottom of the table. How the pager will be displayed is determined by the \Prado\Web\UI\WebControls\getPagerStyle property. Clicking on a pager button will raise an \Prado\Web\UI\WebControls\onPageIndexChanged event. You can respond to this event, specify the page to be displayed by setting \Prado\Web\UI\WebControls\setCurrentPageIndex property, and then invoke databind() on the datagrid to show to end users a new page of data.

    TDataGrid supports two kinds of paging. The first one is based on the number of data items in datasource. The number of pages \Prado\Web\UI\WebControls\getPageCount is calculated based the item number and the \Prado\Web\UI\WebControls\setPageSize property. The datagrid will manage which section of the data source to be displayed based on the \Prado\Web\UI\WebControls\setCurrentPageIndex property. The second approach calculates the page number based on the \Prado\Web\UI\WebControls\setVirtualItemCount property and the \Prado\Web\UI\WebControls\setPageSize property. The datagrid will always display from the beginning of the datasource up to the number of \Prado\Web\UI\WebControls\setPageSize data items. This approach is especially useful when the datasource may contain too many data items to be managed by the datagrid efficiently.

    When the datagrid contains a button control that raises an \Prado\Web\UI\WebControls\onCommand event, the event will be bubbled up to the datagrid control. If the event's command name is recognizable by the datagrid control, a corresponding item event will be raised. The following item events will be raised upon a specific command:

    • OnEditCommand, if CommandName=edit
    • OnCancelCommand, if CommandName=cancel
    • OnSelectCommand, if CommandName=select
    • OnDeleteCommand, if CommandName=delete
    • OnUpdateCommand, if CommandName=update
    • onPageIndexChanged, if CommandName=page
    • OnSortCommand, if CommandName=sort Note, an \Prado\Web\UI\WebControls\onItemCommand event is raised in addition to the above specific command events.

    TDataGrid also raises an \Prado\Web\UI\WebControls\onItemCreated event for every newly created datagrid item. You can respond to this event to customize the content or style of the newly created item.

    Note, the data bound to the datagrid are reset to null after databinding. There are several ways to access the data associated with a datagrid row:

    • Access the data in \Prado\Web\UI\WebControls\onItemDataBound event
    • Use \Prado\Web\UI\WebControls\getDataKeys to obtain the data key associated with the specified datagrid row and use the key to fetch the corresponding data from some persistent storage such as DB.
    • Save the data in viewstate and get it back during postbacks.

    Class hierarchy

    \Prado\Web\UI\WebControls\TDataGrid implements INamingContainer
    Extended by \Prado\Web\UI\WebControls\TBaseDataList
    Extended by \Prado\Web\UI\WebControls\TDataBoundControl
    Extended by \Prado\Web\UI\WebControls\TWebControl implements IStyleable
    Extended by \Prado\Web\UI\TControl implements IRenderable, IBindable
    Extended by \Prado\TApplicationComponent
    Extended by \Prado\TComponent
    Author: Qiang Xue <qiang.xue@gmail.com>
    Since: 3.0
    Methods summary
    public
    addParsedObject(mixed $object) : mixed
    Adds objects parsed in template to datagrid.

    Datagrid columns are added into \Prado\Web\UI\WebControls\getColumns collection.

    public
    bubbleEvent(TControl $sender, TEventParameter $param) : bool
    This method overrides parent's implementation to handle {@see onItemCommand OnItemCommand} event which is bubbled from {@see \Prado\Web\UI\WebControls\TDataGridItem} child controls.

    If the event parameter is TDataGridCommandEventParameter and the command name is a recognized one, which includes 'select', 'edit', 'delete', 'update', and 'cancel' (case-insensitive), then a corresponding command event is also raised (such as \Prado\Web\UI\WebControls\onEditCommand). This method should only be used by control developers.

    public
    getAllowSorting() : bool
    public
    getAlternatingItemStyle() : TTableItemStyle
    public
    getAutoColumns() : TDataGridColumnCollection
    public
    getAutoGenerateColumns() : bool
    public
    getBackImageUrl() : string
    public
    getBottomPager() : TDataGridPager
    public
    getCaption() : string
    public
    getCaptionAlign() : TTableCaptionAlign
    public
    getColumns() : TDataGridColumnCollection
    public
    getEditItem() : TDataGridItem
    public
    getEditItemIndex() : int
    public
    getEditItemStyle() : TTableItemStyle
    public
    getEmptyTemplate() : ITemplate
    public
    getFooter() : TDataGridItem
    public
    getFooterStyle() : TTableItemStyle
    public
    getHeader() : TDataGridItem
    public
    getHeaderStyle() : TTableItemStyle
    public
    getItemCount() : int
    public
    getItems() : TDataGridItemCollection
    public
    getItemStyle() : TTableItemStyle
    public
    getPagerStyle() : TDataGridPagerStyle
    public
    getSelectedItem() : TDataGridItem
    public
    getSelectedItemIndex() : int
    public
    getSelectedItemStyle() : TTableItemStyle
    public
    getShowFooter() : bool
    public
    getShowHeader() : bool
    public
    getTableBodyStyle() : TStyle
    public
    getTableFootStyle() : TStyle
    public
    getTableHeadStyle() : TStyle
    public
    getTopPager() : TDataGridPager
    public
    loadState() : mixed
    Loads item count information from viewstate.

    This method is invoked right after control state is loaded.

    public
    onCancelCommand(TDataGridCommandEventParameter $param) : mixed
    Raises <b>OnCancelCommand</b> event.

    This method is invoked when a button control raises OnCommand event with cancel command name.

    public
    onDeleteCommand(TDataGridCommandEventParameter $param) : mixed
    Raises <b>OnDeleteCommand</b> event.

    This method is invoked when a button control raises OnCommand event with delete command name.

    public
    onEditCommand(TDataGridCommandEventParameter $param) : mixed
    Raises <b>OnEditCommand</b> event.

    This method is invoked when a button control raises OnCommand event with edit command name.

    public
    onItemCommand(TDataGridCommandEventParameter $param) : mixed
    Raises <b>OnItemCommand</b> event.

    This method is invoked when a button control raises OnCommand event.

    public
    onItemCreated(TDataGridItemEventParameter $param) : mixed
    Raises <b>OnItemCreated</b> event.

    This method is invoked right after a datagrid item is created and before added to page hierarchy.

    public
    onItemDataBound(TDataGridItemEventParameter $param) : mixed
    Raises <b>OnItemDataBound</b> event.

    This method is invoked for each datagrid item after it performs databinding.

    public
    onPageIndexChanged(TDataGridPageChangedEventParameter $param) : mixed
    Raises <b>OnPageIndexChanged</b> event.

    This method is invoked when current page is changed.

    public
    onPagerCreated(TDataGridPagerEventParameter $param) : mixed
    Raises <b>OnPagerCreated</b> event.

    This method is invoked right after a datagrid pager is created and before added to page hierarchy.

    public
    onSortCommand(TDataGridSortCommandEventParameter $param) : mixed
    Raises <b>OnSortCommand</b> event.

    This method is invoked when a button control raises OnCommand event with sort command name.

    public
    onUpdateCommand(TDataGridCommandEventParameter $param) : mixed
    Raises <b>OnUpdateCommand</b> event.

    This method is invoked when a button control raises OnCommand event with update command name.

    public
    render(THtmlWriter $writer) : mixed
    Renders the datagrid.
    public
    renderBeginTag(THtmlWriter $writer) : mixed
    Renders the openning tag for the datagrid control which will render table caption if present.
    public
    reset() : mixed
    Clears up all items in the datagrid.
    public
    saveState() : mixed
    Saves item count in viewstate.

    This method is invoked right before control state is to be saved.

    public
    setAllowSorting(bool $value) : mixed
    public
    setAutoGenerateColumns(bool $value) : mixed
    public
    setBackImageUrl(string $value) : mixed
    public
    setCaption(string $value) : mixed
    public
    setCaptionAlign(TTableCaptionAlign $value) : mixed
    public
    setEditItemIndex(int $value) : mixed
    Edits an item by its index in {@see getItems Items}.

    Previously editting item will change to normal item state. If the index is less than 0, any existing edit item will be cleared up.

    public
    setEmptyTemplate(ITemplate $value) : mixed
    public
    setSelectedItemIndex(int $value) : mixed
    Selects an item by its index in {@see getItems Items}.

    Previously selected item will be un-selected. If the item to be selected is already in edit mode, it will remain in edit mode. If the index is less than 0, any existing selection will be cleared up.

    public
    setShowFooter(bool $value) : mixed
    public
    setShowHeader(bool $value) : mixed
    protected
    applyItemStyles() : mixed
    Applies styles to items, header, footer and separators.

    Item styles are applied in a hierarchical way. Style in higher hierarchy will inherit from styles in lower hierarchy. Starting from the lowest hierarchy, the item styles include item's own style, \Prado\Web\UI\WebControls\getItemStyle, \Prado\Web\UI\WebControls\getAlternatingItemStyle, \Prado\Web\UI\WebControls\getSelectedItemStyle, and \Prado\Web\UI\WebControls\getEditItemStyle. Therefore, if background color is set as red in \Prado\Web\UI\WebControls\getItemStyle, \Prado\Web\UI\WebControls\getEditItemStyle will also have red background color unless it is set to a different value explicitly.

    protected
    buildNextPrevPager(TDataGridPager $pager) : mixed
    Builds a next-prev pager
    protected
    buildNumericPager(TDataGridPager $pager) : mixed
    Builds a numeric pager
    protected
    buildPager(TDataGridPager $pager) : mixed
    Builds the pager content based on pager style.
    protected
    createAutoColumns(Traversable $dataSource) : TDataGridColumnCollection
    Automatically generates datagrid columns based on datasource schema
    protected
    createItem(int $itemIndex, mixed $dataSourceIndex, TListItemType $itemType) : TDataGridItem
    Creates a datagrid item instance based on the item type and index.
    protected
    createPager() : mixed
    protected
    createPagerButton(mixed $pager, string $buttonType, bool $enabled, string $text, string $commandName, string $commandParameter) : mixed
    Creates a pager button.

    Depending on the button type, a TLinkButton or a TButton may be created. If it is enabled (clickable), its command name and parameter will also be set. Derived classes may override this method to create additional types of buttons, such as TImageButton.

    protected
    createStyle() : TTableStyle
    Creates a style object for the control.

    This method creates a TTableStyle to be used by datagrid.

    protected
    getAutoGenerateColumnName() : string
    protected
    getTagName() : string
    protected
    initializeItem(TDataGridItem $item, TDataGridColumnCollection $columns) : mixed
    Initializes a datagrid item and cells inside it
    protected
    performDataBinding(Traversable $data) : mixed
    Performs databinding to populate datagrid items from data source.

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

    protected
    renderTable(THtmlWriter $writer) : mixed
    Renders the tabular data.
    protected
    restoreGridFromViewState() : mixed
    Restores datagrid content from viewstate.
    private
    createItemInternal(mixed $itemIndex, mixed $dataSourceIndex, mixed $itemType, mixed $dataBind, mixed $dataItem, mixed $columns) : mixed
    private
    getCellText(mixed $cell) : mixed
    private
    groupCells() : mixed
    Merges consecutive cells who have the same text.
    Inherited methods
    __call, __callStatic, __clone, __construct, __destruct, __get, __isset, __set, __sleep, __unset, __wakeup, addedControl, addParsedObject, applyStyleSheetSkin, asa, attachBehavior, attachBehaviors, attachClassBehavior, attachEventHandler, autoBindProperty, bindProperty, broadcastEvent, bubbleEvent, callBehaviorsMethod, canGetProperty, canSetProperty, clearBehaviors, clearNamingContainer, clearStyle, clearViewState, convertUniqueIdToClientId, copyBaseAttributes, createChildControls, createdOnTemplate, dataBind, dataSourceViewChanged, detachBehavior, detachBehaviors, detachClassBehavior, detachEventHandler, disableBehavior, disableBehaviors, enableBehavior, enableBehaviors, ensureChildControls, evaluateExpression, evaluateStatements, findControl, findControlsByID, findControlsByType, focus, fxAttachClassBehavior, fxDetachClassBehavior, getAccessKey, getAdapter, getAllowChildControls, getAllowCustomPaging, getAllowPaging, getApplication, getAttribute, getAttributes, getAutoGlobalListen, getBackColor, getBehaviors, getBehaviorsEnabled, getBorderColor, getBorderStyle, getBorderWidth, getCellPadding, getCellSpacing, getClassHierarchy, getClientID, getControls, getCssClass, getCurrentPageIndex, getCustomData, getDataKeyField, getDataKeys, getDataMember, getDataSource, getDataSourceID, getDecorator, getDisplay, getEnabled, getEnableTheming, getEnableViewState, getEnsureId, getEventHandlers, getFont, getForeColor, getGridLines, getHasAdapter, getHasAttributes, getHasChildInitialized, getHasControls, getHasInitialized, getHasLoaded, getHasLoadedPostData, getHasPreRendered, getHasStyle, getHeight, getHorizontalAlign, getID, getIsSkinApplied, getListeningToGlobalEvents, getNamingContainer, getPage, getPageCount, getPageSize, getParent, getPluginModule, getRegisteredObject, getRequest, getResponse, getSelectParameters, getService, getSession, getSkinID, getSourceTemplateControl, getStyle, getSubProperty, getTabIndex, getTemplateControl, getToolTip, getUniqueID, getUser, getViewState, getVirtualItemCount, getVisible, getWidth, hasAttribute, hasEvent, hasEventHandler, hasMethod, hasProperty, isa, isObjectRegistered, listen, loadState, onDataBinding, onDataBound, onDataSourceChanged, onInit, onLoad, onPreRender, onSelectedIndexChanged, onUnload, pagePreLoad, publishAsset, publishFilePath, raiseEvent, registerObject, removeAttribute, removedControl, render, renderBeginTag, renderChildren, renderContents, renderControl, renderEndTag, saveState, setAccessKey, setAdapter, setAllowCustomPaging, setAllowPaging, setAttribute, setBackColor, setBorderColor, setBorderStyle, setBorderWidth, setCellPadding, setCellSpacing, setCssClass, setCurrentPageIndex, setCustomData, setDataKeyField, setDataMember, setDataSource, setDataSourceID, setDisplay, setEnabled, setEnableTheming, setEnableViewState, setEnsureId, setForeColor, setGridLines, setHeight, setHorizontalAlign, setID, setPage, setPageSize, setSkinID, setStyle, setSubProperty, setTabIndex, setTemplateControl, setToolTip, setViewState, setVirtualItemCount, setVisible, setWidth, trackViewState, unbindProperty, unlisten, unregisterObject, _getZappableSleepProps, addAttributesToRender, autoDataBindProperties, clearChildState, clearControlState, createControlCollection, createPagedDataSource, createStyle, dataBindChildren, dataBindProperties, determineDataSource, ensureDataBound, getCallChain, getChildControlsCreated, getClassFxEvents, getControlStage, getControlState, getDataFieldValue, getDataSourceView, getInitialized, getIsDataBound, getRequiresDataBinding, getTagName, getUsingDataSourceID, initRecursive, instanceBehavior, isDescendentOf, loadRecursive, loadStateRecursive, performDataBinding, preRenderRecursive, raiseBubbleEvent, saveStateRecursive, setChildControlsCreated, setControlStage, setControlState, setInitialized, setIsDataBound, setRequiresDataBinding, traverseChildControls, unloadRecursive, validateDataSource, broadcastEventInternal, clearCachedUniqueID, clearNameTable, fillNameTable, filter_prado_fx, generateAutomaticID
    Constants summary
    public mixed CMD_CANCEL
    'Cancel'
    public mixed CMD_DELETE
    'Delete'
    public mixed CMD_EDIT
    'Edit'
    public mixed CMD_PAGE
    'Page'
    public mixed CMD_PAGE_FIRST
    'First'
    public mixed CMD_PAGE_LAST
    'Last'
    public mixed CMD_PAGE_NEXT
    'Next'
    public mixed CMD_PAGE_PREV
    'Previous'
    public mixed CMD_SELECT
    Command name that TDataGrid understands.
    'Select'
    public mixed CMD_SORT
    'Sort'
    public mixed CMD_UPDATE
    'Update'
    Inherited constants
    \Prado\Web\UI\TControl::AUTOMATIC_ID_PREFIX, \Prado\Web\UI\TControl::CLIENT_ID_SEPARATOR, \Prado\Web\UI\TControl::CS_CHILD_INITIALIZED, \Prado\Web\UI\TControl::CS_CONSTRUCTED, \Prado\Web\UI\TControl::CS_INITIALIZED, \Prado\Web\UI\TControl::CS_LOADED, \Prado\Web\UI\TControl::CS_PRERENDERED, \Prado\Web\UI\TControl::CS_STATE_LOADED, \Prado\TApplicationComponent::FX_CACHE_FILE, \Prado\TComponent::GLOBAL_RAISE_EVENT_LISTENER, \Prado\Web\UI\TControl::ID_FORMAT, \Prado\Web\UI\TControl::ID_SEPARATOR, \Prado\Web\UI\TControl::IS_CHILD_CREATED, \Prado\Web\UI\TControl::IS_CREATING_CHILD, \Prado\Web\UI\TControl::IS_DISABLE_THEMING, \Prado\Web\UI\TControl::IS_DISABLE_VIEWSTATE, \Prado\Web\UI\TControl::IS_ID_SET, \Prado\Web\UI\TControl::IS_SKIN_APPLIED, \Prado\Web\UI\TControl::IS_STYLESHEET_APPLIED, \Prado\Web\UI\TControl::RF_ADAPTER, \Prado\Web\UI\TControl::RF_AUTO_BINDINGS, \Prado\Web\UI\TControl::RF_CHILD_STATE, \Prado\Web\UI\TControl::RF_CONTROLS, \Prado\Web\UI\TControl::RF_CONTROLSTATE, \Prado\Web\UI\TControl::RF_DATA_BINDINGS, \Prado\Web\UI\TControl::RF_EVENTS, \Prado\Web\UI\TControl::RF_NAMED_CONTROLS, \Prado\Web\UI\TControl::RF_NAMED_CONTROLS_ID, \Prado\Web\UI\TControl::RF_NAMED_OBJECTS, \Prado\Web\UI\TControl::RF_SKIN_ID
    Prado 4.3.0 API Manual