.. include:: ../../global.rst
Grid
####################################################################################################
This custom control shows a configurable grid with inline editing.
It can only be used by getting or setting the value of the control.
Properties
****************************************************************************************************
Details
====================================================================================================
* **Name**, the name of the control.
* **Data Type**, the data type of the control.
General
====================================================================================================
* :strike:`Width`, the width of the control.
* **Visible**, whether the control is shown.
* **Enabled**, whether the control is enabled.
|br|
Data Validation
====================================================================================================
* :strike:`Error Messages (Text), returns a list of rows that have failed validation.`
|br|
Events
****************************************************************************************************
* **Changed**
* **Initialized**
|br|
Screenshots
****************************************************************************************************
| Browser:
.. image:: ../../images/reference/controls/grid/control-grid-firefox.png
:class: browswer-screenshot with-shadow
Value
****************************************************************************************************
Reading the grid control's value in K2's Designer will result in it's current state (in XML), including row values.
Setting the control's value can be done by providing a valid XML value (see `Xml Structure`_).
Columns will be ordered based on the Header's Index Node in the XML.
Rows will be ordered on the Row's Index Node in the XML.
.. _Xml Structure:
XML - Structure
****************************************************************************************************
The following node structure is used in the XML to render a value:
.. code-block::
├── xml definition
└── Grid
├── Headers
¦ └── Header (1 or more)
¦ ├── DataType*
¦ ├── DisplayName (Text)
¦ ├── Index (Number)
¦ ├── Name (Text)
¦ └── Width (must be a value that is a valid width in css)
└── Rows
└── Row (0 or more)
├── Index (Number)
└── RowItem
├── HeaderName (must match one of header names)
└── Value (must be a valid value for the datatype set in the column)
Header Datatype must match one of the following K2 property types:
* ``Date``
* ``DateTime``
* ``Decimal``
* ``Guid``
* ``Memo``
* ``Number``
* ``Text``
* ``Time``
* ``YesNo``
XML - Examples
****************************************************************************************************
Minimal - 1 Header, no rows:
.. code-block:: xml
Full - 9 Headers, 1 row:
.. code-block:: xml
Dc
DecimalColumn
1
Decimal
5%
N
NumberColumn
2
Number
5%
DT
DateTimeColumn
3
DateTime
15%
YN
YesNoColumn
13
YesNo
3%
1
G
CE9CF50E-4121-4ABF-8584-9A50E3A6D570
Dc
2.463
N
012
DT
2019-10-01T12:54
TI
04:05
D
2018-10-01
YN
false
M
T