# DkGridColumnDef

## Generics

<mark style="color:green;">`<T>`</mark> represents the object's shape coming from the data source.&#x20;

<mark style="color:green;">`<R>`</mark> represents the column data type: <mark style="color:green;">`string`</mark>, <mark style="color:green;">`number`</mark>, <mark style="color:green;">`Date`</mark>, or <mark style="color:green;">`boolean`</mark>.

## Methods

| Method                                 | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                                                              |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `addColumns()`                         | <p>It inserts a new column or a set of new columns.<br><br><strong>Params</strong>: </p><ol><li>columns: <mark style="color:green;"><code>DkColumnDef</code></mark>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | <mark style="color:green;"><code>DkColumnDef\[]</code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p> |
| `removeColumns()`                      | <p>It deletes the given columns permanently.<br></p><p><strong>Params</strong>: </p><ol><li>columns: <mark style="color:green;"><code>DkColumnDef</code></mark>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | <mark style="color:green;"><code>DkColumnDef\[]</code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p> |
| `findColumn()`                         | <p>It searches a column in all panels. The found column must meet the compare function criteria.<br></p><p><strong>Params</strong>: </p><ol><li>compare: <mark style="color:green;"><code>CompareColumnFn</code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>DkColumnDef</code></mark>.</p>                                                                                                                                                                                                                                                                                                                                                |                                                                                                                                                              |
| `findNode()`                           | <p>It searches a node in all panels. The found node must meet the compare function criteria.<br></p><p><strong>Params</strong>: </p><ol><li>compare: <mark style="color:green;"><code>CompareNodeFn</code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>DkNodeColumnDef</code></mark>.</p>                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                                                              |
| `setColumnVisible()`                   | <p>It makes <strong>visible</strong> or <strong>non-visible</strong> the given column.<br></p><p><strong>Params</strong>: </p><ol><li>column: <mark style="color:green;"><code>DkColumnDef</code></mark>.</li><li>isVisible: <mark style="color:green;"><code>boolean</code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p>                                                                                                                                                                                                                                                                                           |                                                                                                                                                              |
| `changeColumnWidth<R>()`               | <p>It modifies a data column in width. You can set the minimum and the maximum values.</p><p><br><strong>Params</strong>: </p><ol><li>column: <mark style="color:green;"><code>DkDataColumnDef\<T, R></code></mark>.</li><li>columnSize: { width: <mark style="color:green;"><code>number</code></mark>, minWidth?: <mark style="color:green;"><code>number</code></mark>, maxWidth?: <mark style="color:green;"><code>number</code></mark> }.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p>                                                                                                                                 |                                                                                                                                                              |
| `setColumnGroupable()`                 | <p>It makes the given column <strong>groupable</strong> or <strong>non-groupable</strong>.<br></p><p><strong>Params</strong>: </p><ol><li>column: <mark style="color:green;"><code>DkDataColumnDef\<T, R></code></mark>.</li><li>isGroupable: <mark style="color:green;"><code>boolean</code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p>                                                                                                                                                                                                                                                                          |                                                                                                                                                              |
| `lockColumn()`                         | <p>It locks the column for moving. Remember that the column must be <strong>draggable</strong>.<br><br><strong>Params</strong>:</p><ol><li>column: <mark style="color:green;"><code>DkColumnDef</code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p>                                                                                                                                                                                                                                                                                                                                                                 |                                                                                                                                                              |
| `unlockColumn()`                       | <p>It unlocks the column for moving. Remember that the column must be <strong>draggable</strong>.<br></p><p><strong>Params</strong>:</p><ol><li>column: <mark style="color:green;"><code>DkColumnDef</code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p>                                                                                                                                                                                                                                                                                                                                                            |                                                                                                                                                              |
| `setColumnResizable()`                 | <p>It makes the given column <strong>resizable</strong> or <strong>non-resizable</strong>.<br></p><p><strong>Params</strong>:</p><ol><li>column: <mark style="color:green;"><code>DkColumnDef</code></mark>.</li><li>isResizable: <mark style="color:green;"><code>boolean</code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p>                                                                                                                                                                                                                                                                                      |                                                                                                                                                              |
| `swapColumns()`                        | <p>It interchanges the source and destination columns. Columns must belong to the same group.<br></p><p><strong>Params</strong>:</p><ol><li>sourceColumn: <mark style="color:green;"><code>DkColumnDef</code></mark>.</li><li>destinationColumn: <mark style="color:green;"><code>DkColumnDef</code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p>                                                                                                                                                                                                                                                                   |                                                                                                                                                              |
| `moveColumnBefore()`                   | <p>It moves the given column at the left of the target column. Columns must belong to the same group.<br></p><p><strong>Params</strong>:</p><ol><li>column: <mark style="color:green;"><code>DkColumnDef</code></mark>.</li><li>targetColumn: <mark style="color:green;"><code>DkColumnDef</code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p>                                                                                                                                                                                                                                                                      |                                                                                                                                                              |
| `moveColumnAfter()`                    | <p>It moves the given column to the right side of the target column. Columns must belong to the same group.</p><p></p><p><strong>Params</strong>:</p><ol><li>column: <mark style="color:green;"><code>DkColumnDef</code></mark>.</li><li>targetColumn: <mark style="color:green;"><code>DkColumnDef</code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p>                                                                                                                                                                                                                                                             |                                                                                                                                                              |
| `moveColumnIntoPanel()`                | <p>It moves the given column to the given panel.<br></p><p><strong>Params</strong>:</p><ol><li>column: <mark style="color:green;"><code>DkColumnDef</code></mark>.</li><li>panel: <mark style="color:green;"><code>DkGridPanel</code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p>                                                                                                                                                                                                                                                                                                                                  |                                                                                                                                                              |
| `movePanelColumns()`                   | <p>It moves all columns from the fromPanel panel to the destinationPanel panel. You can move only visible columns by providing the onlyVisibleColumns parameter.<br></p><p><strong>Params</strong>:</p><ol><li>fromPanel: <mark style="color:green;"><code>DkGridPanel</code></mark>.</li><li>destinationPanel: <mark style="color:green;"><code>DkGridPanel</code></mark>.</li><li>onlyVisibleColumns: <mark style="color:green;"><code>boolean</code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p>                                                                                                                |                                                                                                                                                              |
| `setColumnFilterability<R>()`          | <p>It changes the given column as <strong>filterable</strong> or not. You can specify an initial filter, and you can also define your custom filter conditions.<br></p><p><strong>Params</strong>:</p><ol><li>column: <mark style="color:green;"><code>DikeDataColumnDef\<T, R></code></mark>.</li><li>isFilterable: <mark style="color:green;"><code>boolean</code></mark>.</li><li>filter?: <mark style="color:green;"><code>DikeFilter\[]</code></mark>.</li><li>customFilterConditions?: <mark style="color:green;"><code>CustomFilterConditionInstance\<T></code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p> |                                                                                                                                                              |
| `changeColumnFilter<R>()`              | <p>This method establishes a new filter for the given column. The column must be filterable.<br></p><p><strong>Params</strong>:</p><ol><li>column: <mark style="color:green;"><code>DkDataColumnDef\<T, R></code></mark>.</li><li>filter: <mark style="color:green;"><code>DkFilter\[]</code></mark>.</li></ol><p><strong>Return</strong>: void.</p>                                                                                                                                                                                                                                                                                                                         |                                                                                                                                                              |
| `setColumnEditable<R>()`               | <p>It changes the given column as <strong>editable</strong> or not. You can specify the edition setting and the edition template for the given column.<br></p><p><strong>Params</strong>:</p><ol><li>column: <mark style="color:green;"><code>DkDataColumnDef\<T, R></code></mark>.</li><li>isEditable: <mark style="color:green;"><code>boolean</code></mark>.</li><li>settings: { editionSettings?: <mark style="color:green;"><code>EditionFieldSettings</code></mark>, editionTemplate?: <mark style="color:green;"><code>TemplateRef\<any></code></mark> }.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p>               |                                                                                                                                                              |
| `setDefaultEditionTemplateColumn<R>()` | <p>It sets the default edition template again.<br></p><p><strong>Params</strong>:</p><ol><li>column: <mark style="color:green;"><code>DkDataColumnDef\<T, R></code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p>                                                                                                                                                                                                                                                                                                                                                                                                    |                                                                                                                                                              |
| `setDisplayTemplateColumn<R>()`        | <p>It establishes the given template for the given column.<br></p><p><strong>Params</strong>:</p><ol><li>column: <mark style="color:green;"><code>DkDataColumnDef\<T, R></code></mark>.</li><li>displayTemplate: <mark style="color:green;"><code>TemplateRef\<any></code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p>                                                                                                                                                                                                                                                                                             |                                                                                                                                                              |
| `setDefaultDisplayTemplateColumn<R>()` | <p>It establishes the default template for the given column.<br></p><p><strong>Params</strong>:</p><ol><li>column: <mark style="color:green;"><code>DkDataColumnDef\<T, R></code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p>                                                                                                                                                                                                                                                                                                                                                                                      |                                                                                                                                                              |
| `displayRowIndexColumn()`              | <p>It makes visible or non-visible the column that shows the row identifier. You can also change the width of this column.<br></p><p><strong>Params</strong>:</p><ol><li>visible: <mark style="color:green;"><code>boolean</code></mark>.</li><li>width: <mark style="color:green;"><code>number</code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p>                                                                                                                                                                                                                                                                |                                                                                                                                                              |
| `changeColumnGroupStatus()`            | <p>It sets the given status to the given column group.<br></p><p><strong>Params</strong>:</p><ol><li>columnGroup: <mark style="color:green;"><code>DkGroupColumnDef</code></mark>.</li><li>status: <mark style="color:green;"><code>DisplayStatus</code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p>                                                                                                                                                                                                                                                                                                               |                                                                                                                                                              |
| `setColumnSortable<R>()`               | <p>It makes <strong>sortable</strong> or <strong>non-sortable</strong> the given column.<br></p><p><strong>Params</strong>:</p><ol><li>column: <mark style="color:green;"><code>DkDataColumnDef\<T, R></code></mark>.</li><li>isSortable: <mark style="color:green;"><code>boolean</code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p>                                                                                                                                                                                                                                                                              |                                                                                                                                                              |
| `getColumns()`                         | <p>It returns all the existing columns.<br></p><p><strong>Params</strong>: None.</p><p><strong>Return</strong>: <mark style="color:green;"><code>DkColumnDef\[]</code></mark>.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |                                                                                                                                                              |
| `getLinkedColumns()`                   | <p>It returns all the existing columns in a linked-node structure.<br></p><p><strong>Params</strong>: None.</p><p><strong>Return</strong>: <mark style="color:green;"><code>DkNodeColumnDef\[]</code></mark>.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                            |                                                                                                                                                              |

## Events

| Event                        | Description                                                                                                                                                                                                                                                                                                                           |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `columnSizeChange`           | <p>It emits the column that has changed in width.</p><p></p><p><strong>Params</strong>: None.</p><p><strong>Return</strong>: <mark style="color:green;"><code>Observable\<DkDataColumnDef\<T, R>></code></mark>.</p>                                                                                                                  |
| `columnGroupStatusChange`    | <p>It emits the column group that has changed its status. </p><p>It sends the column group until the leaves.</p><p></p><p><strong>Params</strong>: None.</p><p><strong>Return</strong>: <mark style="color:green;"><code>Observable\<DkGroupColumnDef></code></mark>.</p>                                                             |
| `columnLockedChange`         | <p>It emits the locked column for moving.</p><p>For column groups, it sends the column group until the leaves.<br></p><p><strong>Params</strong>: None.</p><p><strong>Return</strong>: <mark style="color:green;"><code>Observable\<DkColumnDef></code></mark>.</p>                                                                   |
| `columnUnLockedChange`       | <p>It emits the unlocked column for moving.</p><p>For column groups, it sends the column group until the leaves.<br></p><p><strong>Params</strong>: None.</p><p><strong>Return</strong>: <mark style="color:green;"><code>Observable\<DkColumnDef></code></mark>.</p>                                                                 |
| `columnVisibleChange`        | <p>It emits the column that changes its visibility.</p><p>For column groups, it sends the column group until the leaves.<br></p><p><strong>Params</strong>: None.</p><p><strong>Return</strong>: <mark style="color:green;"><code>Observable\<DkColumnDef></code></mark>.</p>                                                         |
| `columnMove`                 | <p>It emits an object of type <mark style="color:green;"><code>DkColumnMoveEvent</code></mark>. In this object is specified the type of movement and the columns involved.<br></p><p><strong>Params</strong>: None.</p><p><strong>Return</strong>: <mark style="color:green;"><code>Observable\<DkColumnMoveEvent></code></mark>.</p> |
| `columnsChange`              | <p>It emits the current columns from all panels. DkGrid emits this event every time a column operation occurs.<br></p><p><strong>Params</strong>: None.</p><p><strong>Return</strong>: <mark style="color:green;"><code>Observable\<DkColumnDef\[]></code></mark>.</p>                                                                |
| `contentPanelsColumnsChange` | <p>It emits the current columns from the content panels. DkGrid emits this event every time a column operation occurs.<br></p><p><strong>Params</strong>: None.</p><p><strong>Return</strong>: <mark style="color:green;"><code>Observable\<DkColumnDef\[]></code></mark>.</p>                                                        |
| `columnsRemovedChange`       | <p>DkGrid emits this event when you delete a column.<br></p><p><strong>Params</strong>: None.</p><p><strong>Return</strong>: <mark style="color:green;"><code>Observable\<DkColumnDef\[]></code></mark>.</p>                                                                                                                          |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dikesoft.com/reference/dkgrid-api/dkgridcolumndef.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
