|
||
The following properties of the UniGrid control can be set or used in the API:
Property Name |
Description |
Sample Value |
|
Columns |
Specifies the columns that should be loaded from the data source specified in the DataSource property.
By default, the values of the first column are passed as the actionArgument parameter of the OnAction event handler. This can be overridden in the definition by specifying a column name in the commandargument attribute of individual <action> elements. |
||
CompleteWhereCondition |
Can be used to get the used WHERE clause including any modifications applied by the filter. |
||
DataSource |
Can be used to gets or set the DataSet object containing the data that the UniGrid displays.
You can alternatively assign the UniGrid's data through:
•The control's ObjectType or Query properties •The objecttype or query elements in the UniGrid definition |
||
DelayedReload |
If enabled, data will not be loaded automatically during the Load event of the page and the ReloadData() method must be called manually instead. |
||
FilterDirectoryPath |
Path to the control (.ascx file) that should be used instead of the default filter. The default relative path is ~/CMSAdminControls/UI/UniGrid/Filters/. |
||
FilteredZeroRowsText |
Text to be shown when no rows are displayed after the filter is applied. |
||
FilterLimit |
Determines the minimum amount of rows that must be displayed in the UniGrid before a filter is shown. The default value is read from the CMSDefaultListingFilterLimit web.config key. |
||
GridName |
Contains the name of an external XML file that defines the structure and behaviour of the UniGrid control. For more information, please refer to the UniGrid definition topic. |
||
GridView |
Can be used to access the GridView control encapsulated by the UniGrid. |
||
HideControlForZeroRows |
Indicates whether the control should be hidden when no rows are loaded. The control is not hidden if the filter causes zero rows to be displayed. |
||
ImageDirectoryPath |
Path to the directory that contains images used by the control. The default value is ~/App_Themes/Default/Images/Design/Controls/UniGrid/Actions. |
||
NamedColumns |
Gets a dictionary mapping custom names to DataControlField objects that represent the columns of the UniGrid.
The names of columns can be specified in the UniGrid's definition through the name attribute of individual <column> elements.
This can be used to access the grid's columns in your code.
For example:
[C#]
When executed, this code would hide the column named column1. |
||
ObjectType |
Can be used to define the data class of the objects that should be loaded as the data source and displayed by the UniGrid control. A list of all available data classes and related information can be found in the CMS_Class database table.
Alternatively, the same can be defined in the UniGrid's definition through the <objecttype> element as described in the following topic.
Please note that this approach is not supported for classes representing document types (i.e. those whose value in the ClassIsDocumentType column is 1). In these cases, you can load the required data by specifying an appropriate query through the Query property. |
||
OrderBy |
The ORDER BY clause used to determine how the UniGrid rows are sorted when the page is first loaded. |
||
Pager |
Can be used to access the UniGridPager control used for paging. |
||
PageSize |
This setting can be used to override the default values offered by the page size selection drop‑down list. Values must be separated by commas.
The ##ALL## macro can be used as a value to indicate that all rows should be displayed.
The default value is “25,50,100,##ALL##”. |
"10,20,##ALL##" |
|
Query |
Can be used to specify the name of the query that should be used to retrieve data from the Kentico CMS database to be displayed by the UniGrid control. The name is entered in format <class name>.<query name>.
Alternatively, the same can be defined in the definition through the <query> element as described in the following topic. |
"cms.user.selectallview" |
|
SelectedItems |
Gets (as an ArrayList) or sets the currently selected rows from the UniGrid. |
||
ShowActionsMenu |
Indicates whether the header of the actions column should contain a context menu that provides the option to export the data displayed in the grid into various other formats (Excel, CSV or XML). |
||
ShowObjectMenu |
Indicates if an action providing a context menu with object actions should automatically be added to the displayed grid. This requires the data source of the UniGrid to be an object type, specified either through the <objecttype> element or the ObjectType property.
This menu provides options that can be used to Export, Backup, Restore or Destroy individual listed objects. Some types of objects may not have all menu options available.
This action is not added if there is another action specified that has a contextmenu attribute or in cases where there are no actions at all defined for the grid.
The default value is true. |
||
SortDirect |
The ORDER BY clause reflecting the current row sorting being used by the UniGrid. |
||
TopN |
Specifies the maximum amount of rows that should be selected. |
||
WhereCondition |
Can be used to get the used WHERE clause without modifications applied by the filter. |
||
ZeroRowsText |
Text to be shown when the control is hidden by the HideControlForZeroRows property. |
The following events of the UniGrid control are available:
Event Name |
Description |
OnAction |
Occurs when one of the actions of the control is used. The name of the given action is passed as a parameter to the handlers of the event. An example of how it is used can be found in the tutorial found in the Getting started topic. |
OnExternalDataBound |
Occurs after data is loaded. It is used to implement a custom design or functionality for UniGrid columns, including the action column. An example of how it is used can be found in the Implementing custom functionality topic. |
OnBeforeDataReload |
This event can be used to perform any actions before the ReloadData() method is executed. |
OnAfterDataReload |
This event can be used to perform any actions after the ReloadData() method is executed. |
The following are application settings that you can use in your web.config to modify the behavior if UniGrid instances throughout the system:
Key |
Description |
Sample Value |
CMSDefaultListingFilterLimit |
Determines the minimum number of items that must be included in a listing in order for a filter to be shown. If the number of listed items is lower than this value, the filter is not displayed. If it is larger, the filter is displayed. This applies to all listings (UniGrid controls) across the entire UI
The default value is 25.
The value of this key can be overridden for individual UniGrid controls. |
<add key="CMSDefaultListingFilterLimit" value="40" /> |
CMSDefaultListingPageSize |
Initial page size (the Items per page setting) of listings across the whole UI.
The default value is 25. |
<add key="CMSDefaultListingPageSize" value="50" /> |
CMSListingShowFirstLastButtons |
If enabled, the first and last page link buttons will be included in the pagers of listings in the UI with a large enough number of items. If disabled, the buttons will always be hidden.
If both this and the ShowDirectPageControl keys are disabled, only TopN items are loaded, while TopN = PageSize * (currentPageIndex + CurrentPagesGroupSize).
The default value is true. |
<add key="CMSListingShowFirstLastButtons" value="false" /> |
CMSListingShowDirectPageControl |
If enabled, a textbox that allows the current page to be changed by directly entering a number will be included in pagers of listings in the UI with a large enough number of items. If disabled, the control will always be hidden.
If both this and the ShowFirstLastButtons keys are disabled, only TopN items are loaded, while TopN = PageSize * (currentPageIndex + CurrentPagesGroupSize).
The default value is true. |
<add key="CMSListingShowDirectPageControl" value="false" /> |