From: Bill Erickson Date: Wed, 28 Aug 2019 20:20:36 +0000 (-0400) Subject: CSP grid / row flair example X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fberick%2Fcsp-grid-flair;p=working%2FEvergreen.git CSP grid / row flair example Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html index b2d14c1b95..b8568f0d50 100644 --- a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html +++ b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html @@ -387,3 +387,14 @@ + + +
+ + +
+ + diff --git a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts index c6ea7c3f17..c04d19eab2 100644 --- a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts @@ -50,8 +50,8 @@ export class SandboxComponent implements OnInit { @ViewChild('bresvEditor') private bresvEditor: FmRecordEditorComponent; - - // @ViewChild('helloStr') private helloStr: StringComponent; + @ViewChild('cspFlairTooltip') private cspFlairTooltip: StringComponent; + cspRowFlairCallback: (row: any) => GridRowFlairEntry; gridDataSource: GridDataSource = new GridDataSource(); @@ -61,6 +61,7 @@ export class SandboxComponent implements OnInit { btSource: GridDataSource = new GridDataSource(); acpSource: GridDataSource = new GridDataSource(); + cspSource: GridDataSource = new GridDataSource(); editSelected: (rows: IdlObject[]) => void; @ViewChild('acpGrid') acpGrid: GridComponent; @ViewChild('acpEditDialog') editDialog: FmRecordEditorComponent; @@ -269,6 +270,22 @@ export class SandboxComponent implements OnInit { } } ) }); + + this.cspSource.getRows = (pager: Pager, sort: any[]) => { + // ... paging, etc. + return this.pcrud.retrieveAll('csp'); + } + + this.cspRowFlairCallback = (row: any): GridRowFlairEntry => { + // Define in ngOnInit() so we can access 'this' + const flair = {icon: null, title: null}; + if (row.id() < 100) { + flair.icon = 'not_interested'; + // String is static text -- no interpolation required. + flair.title = this.cspFlairTooltip.text; + } + return flair; + } } sbChannelHandler = msg => {