-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemaillinkdata-grid.component.ts
More file actions
70 lines (66 loc) · 2.09 KB
/
emaillinkdata-grid.component.ts
File metadata and controls
70 lines (66 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// data-grid.component.ts (updated parts only)
import { Component, OnInit } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { EmailLinkRendererComponent } from './email-link-renderer.component';
// ... other imports remain the same
@Component({
selector: 'app-data-grid',
template: `
<div style="height: 600px; width: 100%;">
<ag-grid-angular
style="width: 100%; height: 100%;"
class="ag-theme-material"
[gridOptions]="gridOptions"
[rowData]="rowData"
[frameworkComponents]="frameworkComponents"
(gridReady)="onGridReady($event)">
</ag-grid-angular>
</div>
`,
// ... rest of the component decorator remains the same
})
export class DataGridComponent implements OnInit {
gridOptions: GridOptions;
rowData: any[] = [];
frameworkComponents: any;
constructor(private dialog: MatDialog) {
this.frameworkComponents = {
emailLinkRenderer: EmailLinkRendererComponent
};
this.gridOptions = {
masterDetail: true,
detailCellRendererParams: {
detailGridOptions: {
columnDefs: [
{ field: 'id', headerName: 'ID' },
{ field: 'description', headerName: 'Description' },
{ field: 'value', headerName: 'Value' },
{
field: 'emailAction',
headerName: 'Action',
cellRenderer: 'emailLinkRenderer',
cellRendererParams: {
value: 'Send Email' // Default link text
}
}
],
// Remove the onRowClicked handler since we're using the cell renderer now
},
getDetailRowData: (params) => {
params.successCallback(this.getDetailData(params.data));
}
},
columnDefs: [
{ field: 'name', headerName: 'Name', rowGroup: true },
{ field: 'id', headerName: 'ID' },
{ field: 'status', headerName: 'Status' }
],
defaultColDef: {
sortable: true,
filter: true,
resizable: true
}
};
}
// ... rest of the component remains the same
}