<div class="w-100 mt-2 mb-2">
<eg-grid #grid idlClass={{idl_class}}
[dataSource]="grid_source"
- [rowFlairIsEnabled]="true"
- [rowFlairCallback]="rowFlairCallback"
- [cellClassCallback]="gridCellClassCallback"
[sortable]="true">
<eg-grid-toolbar-button
label="Create {{table_name}}" (onClick)="createNew()" i18n-label>
import {PcrudService} from '@eg/core/pcrud.service';
import {GridComponent} from '@eg/share/grid/grid.component';
import {Pager} from '@eg/share/util/pager';
-import {GridDataSource, GridColumn, GridRowFlairEntry} from '@eg/share/grid/grid';
+import {GridDataSource, GridColumn} from '@eg/share/grid/grid';
import {FmRecordEditorComponent} from '@eg/share/fm-editor/fm-editor.component';
import {StringComponent} from '@eg/share/string/string.component';
import {ToastService} from '@eg/share/toast/toast.service';
@ViewChild('updateFailedString', { static: false }) updateFailedString: StringComponent;
@ViewChild('deleteFailedString', { static: true }) deleteFailedString: StringComponent;
@ViewChild('deleteSuccessString', { static: true }) deleteSuccessString: StringComponent;
- @ViewChild('flairTooltip', { static: true }) private flairTooltip: StringComponent;
- rowFlairCallback: (row: any) => GridRowFlairEntry;
@Input() sort_field: string;
@Input() idl_class = "acmc";
@Input() dialog_size: 'sm' | 'lg' = 'lg';
ngOnInit() {
this.getSource();
- this.rowFlair();
}
/**
};
}
- rowFlair() {
- this.rowFlairCallback = (row: any): GridRowFlairEntry => {
- const flair = {icon: null, title: null};
- if (row.id() < 100) {
- flair.icon = 'not_interested';
- flair.title = this.flairTooltip.text;
- }
- return flair;
- };
- }
-
- gridCellClassCallback = (row: any, col: GridColumn): string => {
- if (col.name === 'id' && row.a[0] < 100) {
- return 'text-danger';
- }
- return '';
- }
-
showEditDialog(standingPenalty: IdlObject): Promise<any> {
this.editDialog.mode = 'update';
this.editDialog.recordId = standingPenalty['id']();