# Grid Row Selection with Interactive Elements

## Environment

<table>
    <tbody>
	    <tr>
	    	<td>Product</td>
	    	<td>Progress® Kendo UI® for Angular Grid</td>
	    </tr>
    </tbody>
</table>

## Description

How can I select a row in the Grid when a hyperlink, icon, or button is clicked?

## Solution

To achieve the desired behavior, you can implement custom selection by combining the functionalities of the [`CellTemplateDirective`](https://www.telerik.com/kendo-angular-ui/components/grid/api/celltemplatedirective) and the [`SelectionDirective`](https://www.telerik.com/kendo-angular-ui/components/grid/api/selectiondirective) of the Grid component:

1. Bind a click event handler to the desired interactive elements. To track the current row that contains the respective element, use the `rowIndex` context field provided by the `CellTemplateDirective`:

   ```html
   <kendo-grid-column title="Icon">
       <ng-template kendoGridCellTemplate let-rowIndex="rowIndex">
           <kendo-svgicon [icon]="checkCircle" (click)="selectRowByClick(rowIndex)"></kendo-svgicon>
       </ng-template>
   </kendo-grid-column>
   ```

2. In the event handler, update the [`selectedKeys`](https://www.telerik.com/kendo-angular-ui/components/grid/api/selectiondirective#selectedkeys) collection of the Grid with the `rowIndex` associated with the corresponding cell:

   ```ts
   public mySelection: number[] = [];

   public selectRowByClick(rowIndex: number): void {
       this.mySelection.push(rowIndex);
       this.mySelection = [...this.mySelection];
   }
   ```

The following example demonstrates the suggested approach.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/knowledge-base/grid-custom-row-selection-interactive-elements/source.txt)

## See Also

* [Kendo UI for Angular Grid Selection Basics](https://www.telerik.com/kendo-angular-ui/components/grid/selection)
* [Kendo UI for Angular Grid Documentation](https://www.telerik.com/kendo-angular-ui/components/grid)
* [API Reference of the Grid Component](https://www.telerik.com/kendo-angular-ui/components/grid/api/gridcomponent)
