Documentation

Grid rows

Grid rows are defined by parameter ROWS.


String parameters

ParameterTypeDescription
idstring / intString identifier.
columnsarrayArray with data for column cells, in the format 'COLUMN_ID' => 'Cell data', or 'COLUMN_ID' => [...] if column type is LABELS or TAGS from \Bitrix\Main\Grid\Column\Type.

Example
dataarrayData for inline editing. For example, we can pass data for a cell to be displayed as is - inside the data cell we can pass data that are needed for editing.
'columns' => [
	'HREF' => '<a href="/my/url">My url</a>',
	...,
],
'data' => [
	'HREF' => '/my/url',
	...,    
],

Also, data can be used as an alternative for columns, for the backward compatibility with [link=11528238]previous legacy grid version[/link]. In case, 'columns' is not defined, grid will attempt to print data from 'data'.

editableColumnsarrayDefines cell as editable at the row level. For example, for an editable column you can specifically restrict cell editing by defining cell ID as false.
'editableColumns' => [
	'MY_COLUMN_ID' => false,
],
actionsarrayDefines actions available for the cell.
'actions' => [
	[
		'delimiter' => boolean,
		'className' => string,
		'title' => string,
		'text' => string,
		'onclick' => string,
		'href' => string,
		'default' => boolean,
		'items' => array,
	],
	...,
],
customstringArbitrary string content. Printed in a single cell.
countersarrayCounters. Allows printing counters for any row's cell.
'counters' => [
	'COLUMN_ID' => [
		'type' => \Bitrix\Main\Grid\Counter\Type::LEFT,
		'value' => 2,
		'color' => 'counter-color-css-class',
		'size' => 'counter-size-css-class',
		'class' => 'counter-custom-css-class',
		],
	...,
],
cellActionsarrayAllows printing additional control actions for a cell.
'cellActions' => [
	'col1' => [
		[
			'class' => [
			\Bitrix\Main\Grid\CellActions::PIN,
			\Bitrix\Main\Grid\CellActionState::ACTIVE,
			],
			'events' => [
				'click' => 'onCellActionButtonClick',
				],
			'attributes' => [
				'data-test' => 'test',
			],
		],
		[
			'class' => [
				\Bitrix\Main\Grid\CellActions::MUTE,
				\Bitrix\Main\Grid\CellActionState::ACTIVE,
			],
			'events' => [
				'click' => 'onCellActionButtonClick',
				],
			'attributes' => [
				'data-test' => 'test',
			],
		],
	],
],

© «Bitrix24», 2001-2024
Up