-
Notifications
You must be signed in to change notification settings - Fork 155
/
Copy pathdetail-expand-cell-renderer.ts
41 lines (35 loc) · 1.49 KB
/
detail-expand-cell-renderer.ts
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
import { isNullOrUndefined } from '@syncfusion/ej2-base';
import { ICellRenderer } from '../base/interface';
import { CellRenderer } from './cell-renderer';
import { Column } from '../models/column';
import { Cell } from '../models/cell';
/**
* ExpandCellRenderer class which responsible for building group expand cell.
*
* @hidden
*/
export class DetailExpandCellRenderer extends CellRenderer implements ICellRenderer<Column> {
public element: HTMLElement = this.parent.createElement('TD', {
className: 'e-detailrowcollapse',
attrs: { 'aria-expanded': 'false', role: 'gridcell', tabindex: '-1' }
});
/**
* Function to render the detail expand cell
*
* @param {Cell<Column>} cell - specifies the cell
* @param {Object} data - specifies the data
* @param {Object} attributes - specifies the attributes
* @returns {Element} returns the element
*/
public render(cell: Cell<Column>, data: Object, attributes?: Object): Element {
const node: Element = this.element.cloneNode() as Element;
if (attributes && !isNullOrUndefined(attributes['class'])) {
node.className = '';
node.className = attributes['class'];
node.appendChild(this.parent.createElement('div', { className: 'e-icons e-dtdiagonaldown e-icon-gdownarrow' }));
} else {
node.appendChild(this.parent.createElement('div', { className: 'e-icons e-dtdiagonalright e-icon-grightarrow' }));
}
return node;
}
}