2 * Collection of grid related classses and interfaces.
4 import {TemplateRef, EventEmitter} from '@angular/core';
5 import {Observable, Subscription} from 'rxjs';
6 import {IdlService, IdlObject} from '@eg/core/idl.service';
7 import {OrgService} from '@eg/core/org.service';
8 import {ServerStoreService} from '@eg/core/server-store.service';
9 import {FormatService} from '@eg/core/format.service';
10 import {Pager} from '@eg/share/util/pager';
12 const MAX_ALL_ROW_COUNT = 10000;
14 export class GridColumn {
23 // IDL class of the object which contains this field.
24 // Not to be confused with the class of a linked object.
28 datePlusTime: boolean;
29 cellTemplate: TemplateRef<any>;
32 isDragTarget: boolean;
34 isMultiSortable: boolean;
35 comparator: (valueA: any, valueB: any) => number;
37 // True if the column was automatically generated.
40 flesher: (obj: any, col: GridColumn, item: any) => any;
42 getCellContext(row: any) {
46 userContext: this.cellContext
51 export class GridColumnSet {
52 columns: GridColumn[];
54 indexColumn: GridColumn;
56 isMultiSortable: boolean;
57 stockVisible: string[];
59 defaultHiddenFields: string[];
60 defaultVisibleFields: string[];
62 constructor(idl: IdlService, idlClass?: string) {
65 this.stockVisible = [];
66 this.idlClass = idlClass;
69 add(col: GridColumn) {
71 this.applyColumnDefaults(col);
73 if (!this.insertColumn(col)) {
74 // Column was rejected as a duplicate.
78 if (col.isIndex) { this.indexColumn = col; }
80 // track which fields are visible on page load.
82 this.stockVisible.push(col.name);
85 this.applyColumnSortability(col);
88 // Returns true if the new column was inserted, false otherwise.
89 // Declared columns take precedence over auto-generated columns
90 // when collisions occur.
91 // Declared columns are inserted in front of auto columns.
92 insertColumn(col: GridColumn): boolean {
95 if (this.getColByName(col.name)) {
96 // New auto-generated column conflicts with existing
100 // No collisions. Add to the end of the list
101 this.columns.push(col);
106 // Adding a declared column.
109 for (let idx = 0; idx < this.columns.length; idx++) {
110 const testCol = this.columns[idx];
111 if (testCol.name === col.name) { // match found
112 if (testCol.isAuto) {
113 // new column takes precedence, remove the existing column.
114 this.columns.splice(idx, 1);
117 // New column does not take precedence. Avoid
124 // Delcared columns are inserted just before the first auto-column
125 for (let idx = 0; idx < this.columns.length; idx++) {
126 const testCol = this.columns[idx];
127 if (testCol.isAuto) {
129 this.columns.unshift(col);
131 this.columns.splice(idx - 1, 0, col);
137 // No insertion point found. Toss the new column on the end.
138 this.columns.push(col);
142 getColByName(name: string): GridColumn {
143 return this.columns.filter(c => c.name === name)[0];
146 idlInfoFromDotpath(dotpath: string): any {
147 if (!dotpath || !this.idlClass) { return null; }
151 let idlClass = this.idl.classes[this.idlClass];
153 const pathParts = dotpath.split(/\./);
155 for (let i = 0; i < pathParts.length; i++) {
156 const part = pathParts[i];
157 idlParent = idlField;
158 idlField = idlClass.field_map[part];
161 if (idlField['class'] && (
162 idlField.datatype === 'link' ||
163 idlField.datatype === 'org_unit')) {
164 idlClass = this.idl.classes[idlField['class']];
172 idlParent: idlParent,
180 this.columns.forEach(col => {
184 col.visible = this.stockVisible.includes(col.name);
188 applyColumnDefaults(col: GridColumn) {
190 if (!col.idlFieldDef && col.path) {
191 const idlInfo = this.idlInfoFromDotpath(col.path);
193 col.idlFieldDef = idlInfo.idlField;
194 col.idlClass = idlInfo.idlClass.name;
196 col.label = col.idlFieldDef.label || col.idlFieldDef.name;
197 col.datatype = col.idlFieldDef.datatype;
202 if (!col.name) { col.name = col.path; }
203 if (!col.flex) { col.flex = 2; }
204 if (!col.align) { col.align = 'left'; }
205 if (!col.label) { col.label = col.name; }
206 if (!col.datatype) { col.datatype = 'text'; }
208 col.visible = !col.hidden;
211 applyColumnSortability(col: GridColumn) {
212 // column sortability defaults to the sortability of the column set.
213 if (col.isSortable === undefined && this.isSortable) {
214 col.isSortable = true;
217 if (col.isMultiSortable === undefined && this.isMultiSortable) {
218 col.isMultiSortable = true;
221 if (col.isMultiSortable) {
222 col.isSortable = true;
226 displayColumns(): GridColumn[] {
227 return this.columns.filter(c => c.visible);
230 insertBefore(source: GridColumn, target: GridColumn) {
233 this.columns.forEach((col, idx) => {
234 if (col.name === target.name) { targetIdx = idx; }});
236 this.columns.forEach((col, idx) => {
237 if (col.name === source.name) { sourceIdx = idx; }});
239 if (sourceIdx >= 0) {
240 this.columns.splice(sourceIdx, 1);
243 this.columns.splice(targetIdx, 0, source);
246 // Move visible columns to the front of the list.
247 moveVisibleToFront() {
248 const newCols = this.displayColumns();
249 this.columns.forEach(col => {
250 if (!col.visible) { newCols.push(col); }});
251 this.columns = newCols;
254 moveColumn(col: GridColumn, diff: number) {
255 let srcIdx, targetIdx;
257 this.columns.forEach((c, i) => {
258 if (c.name === col.name) { srcIdx = i; }
261 targetIdx = srcIdx + diff;
264 } else if (targetIdx >= this.columns.length) {
265 // Target index follows the last visible column.
267 this.columns.forEach((c, idx) => {
268 if (c.visible) { lastVisible = idx; }
271 // When moving a column (down) causes one or more
272 // visible columns to shuffle forward, our column
273 // moves into the slot of the last visible column.
274 // Otherwise, put it into the slot directly following
275 // the last visible column.
276 targetIdx = srcIdx <= lastVisible ? lastVisible : lastVisible + 1;
279 // Splice column out of old position, insert at new position.
280 this.columns.splice(srcIdx, 1);
281 this.columns.splice(targetIdx, 0, col);
284 compileSaveObject(): GridColumnPersistConf[] {
285 // only store information about visible columns.
286 // scrunch the data down to just the needed info.
287 return this.displayColumns().map(col => {
288 const c: GridColumnPersistConf = {name : col.name};
289 if (col.align !== 'left') { c.align = col.align; }
290 if (col.flex !== 2) { c.flex = Number(col.flex); }
291 if (Number(col.sort)) { c.sort = Number(c.sort); }
296 applyColumnSettings(conf: GridColumnPersistConf[]) {
298 if (!conf || conf.length === 0) {
299 // No configuration is available, but we have a list of
300 // fields to show or hide by default
302 if (this.defaultVisibleFields) {
303 this.columns.forEach(col => {
304 if (this.defaultVisibleFields.includes(col.name)) {
311 } else if (this.defaultHiddenFields) {
312 this.defaultHiddenFields.forEach(name => {
313 const col = this.getColByName(name);
325 conf.forEach(colConf => {
326 const col = this.getColByName(colConf.name);
327 if (!col) { return; } // no such column in this grid.
330 if (colConf.align) { col.align = colConf.align; }
331 if (colConf.flex) { col.flex = Number(colConf.flex); }
332 if (colConf.sort) { col.sort = Number(colConf.sort); }
334 // Add to new columns array, avoid dupes.
335 if (newCols.filter(c => c.name === col.name).length === 0) {
340 // columns which are not expressed within the saved
341 // configuration are marked as non-visible and
342 // appended to the end of the new list of columns.
343 this.columns.forEach(c => {
344 if (conf.filter(cf => cf.name === c.name).length === 0) {
350 this.columns = newCols;
355 export class GridRowSelector {
356 indexes: {[string: string]: boolean};
362 // Returns true if all of the requested indexes exist in the selector.
363 contains(index: string | string[]): boolean {
364 const indexes = [].concat(index);
365 for (let i = 0; i < indexes.length; i++) { // early exit
366 if (!this.indexes[indexes[i]]) {
373 select(index: string | string[]) {
374 const indexes = [].concat(index);
375 indexes.forEach(i => this.indexes[i] = true);
378 deselect(index: string | string[]) {
379 const indexes = [].concat(index);
380 indexes.forEach(i => delete this.indexes[i]);
383 // Returns the list of selected index values.
384 // in some contexts (template checkboxes) the value for an index is
385 // set to false to deselect instead of having it removed (via deselect()).
387 return Object.keys(this.indexes).filter(
388 ind => Boolean(this.indexes[ind]));
392 return this.selected().length === 0;
400 export interface GridRowFlairEntry {
401 icon: string; // name of material icon
402 title?: string; // tooltip string
405 export class GridColumnPersistConf {
412 export class GridPersistConf {
415 columns: GridColumnPersistConf[];
418 export class GridContext {
423 isMultiSortable: boolean;
424 useLocalSort: boolean;
426 disableMultiSelect: boolean;
427 disableSelect: boolean;
428 dataSource: GridDataSource;
429 columnSet: GridColumnSet;
430 rowSelector: GridRowSelector;
431 toolbarButtons: GridToolbarButton[];
432 toolbarCheckboxes: GridToolbarCheckbox[];
433 toolbarActions: GridToolbarAction[];
434 lastSelectedIndex: any;
435 pageChanges: Subscription;
436 rowFlairIsEnabled: boolean;
437 rowFlairCallback: (row: any) => GridRowFlairEntry;
438 rowClassCallback: (row: any) => string;
439 cellClassCallback: (row: any, col: GridColumn) => string;
440 defaultVisibleFields: string[];
441 defaultHiddenFields: string[];
442 overflowCells: boolean;
443 showLinkSelectors: boolean;
445 // Allow calling code to know when the select-all-rows-in-page
446 // action has occurred.
447 selectRowsInPageEmitter: EventEmitter<void>;
449 // Services injected by our grid component
452 store: ServerStoreService;
453 format: FormatService;
458 store: ServerStoreService,
459 format: FormatService) {
464 this.format = format;
465 this.pager = new Pager();
466 this.pager.limit = 10;
467 this.rowSelector = new GridRowSelector();
468 this.toolbarButtons = [];
469 this.toolbarCheckboxes = [];
470 this.toolbarActions = [];
474 this.selectRowsInPageEmitter = new EventEmitter<void>();
475 this.columnSet = new GridColumnSet(this.idl, this.idlClass);
476 this.columnSet.isSortable = this.isSortable === true;
477 this.columnSet.isMultiSortable = this.isMultiSortable === true;
478 this.columnSet.defaultHiddenFields = this.defaultHiddenFields;
479 this.columnSet.defaultVisibleFields = this.defaultVisibleFields;
480 this.generateColumns();
483 // Load initial settings and data.
485 this.applyGridConfig()
486 .then(ok => this.dataSource.requestPage(this.pager))
487 .then(ok => this.listenToPager());
494 applyGridConfig(): Promise<void> {
495 return this.getGridConfig(this.persistKey)
499 columns = conf.columns;
501 this.pager.limit = conf.limit;
505 // This is called regardless of the presence of saved
506 // settings so defaults can be applied.
507 this.columnSet.applyColumnSettings(columns);
512 // Give the UI time to settle before reloading grid data.
513 // This can help when data retrieval depends on a value
514 // getting modified by an angular digest cycle.
517 this.dataSource.reset();
518 this.dataSource.requestPage(this.pager);
522 // Sort the existing data source instead of requesting sorted
523 // data from the client. Reset pager to page 1. As with reload(),
524 // give the client a chance to setting before redisplaying.
528 this.sortLocalData();
529 this.dataSource.requestPage(this.pager);
533 // Subscribe or unsubscribe to page-change events from the pager.
535 if (this.pageChanges) { return; }
536 this.pageChanges = this.pager.onChange$.subscribe(
537 val => this.dataSource.requestPage(this.pager));
541 if (!this.pageChanges) { return; }
542 this.pageChanges.unsubscribe();
543 this.pageChanges = null;
546 // Sort data in the data source array
549 const sortDefs = this.dataSource.sort.map(sort => {
550 const column = this.columnSet.getColByName(sort.name);
558 if (!def.col.comparator) {
559 switch (def.col.datatype) {
563 def.col.comparator = (a, b) => {
566 if (a < b) { return -1; }
567 if (a > b) { return 1; }
572 def.col.comparator = (a, b) => {
573 if (a < b) { return -1; }
574 if (a > b) { return 1; }
583 this.dataSource.data.sort((rowA, rowB) => {
585 for (let idx = 0; idx < sortDefs.length; idx++) {
586 const sortDef = sortDefs[idx];
588 const valueA = this.getRowColumnValue(rowA, sortDef.col);
589 const valueB = this.getRowColumnValue(rowB, sortDef.col);
591 if (valueA === '' && valueB === '') { continue; }
592 if (valueA === '' && valueB !== '') { return 1; }
593 if (valueA !== '' && valueB === '') { return -1; }
595 const diff = sortDef.col.comparator(valueA, valueB);
596 if (diff === 0) { continue; }
598 return sortDef.dir === 'DESC' ? -diff : diff;
601 return 0; // No differences found.
605 getRowIndex(row: any): any {
606 const col = this.columnSet.indexColumn;
608 throw new Error('grid index column required');
610 return this.getRowColumnValue(row, col);
613 // Returns position in the data source array of the row with
614 // the provided index.
615 getRowPosition(index: any): number {
616 // for-loop for early exit
617 for (let idx = 0; idx < this.dataSource.data.length; idx++) {
618 const row = this.dataSource.data[idx];
619 if (row !== undefined && index === this.getRowIndex(row)) {
625 // Return the row with the provided index.
626 getRowByIndex(index: any): any {
627 for (let idx = 0; idx < this.dataSource.data.length; idx++) {
628 const row = this.dataSource.data[idx];
629 if (row !== undefined && index === this.getRowIndex(row)) {
635 // Returns all selected rows, regardless of whether they are
636 // currently visible in the grid display.
637 getSelectedRows(): any[] {
639 this.rowSelector.selected().forEach(index => {
640 const row = this.getRowByIndex(index);
648 getRowColumnValue(row: any, col: GridColumn): string {
652 val = this.nestedItemFieldValue(row, col);
653 } else if (col.name in row) {
654 val = this.getObjectFieldValue(row, col.name);
657 return this.format.transform({
659 idlClass: col.idlClass,
660 idlField: col.idlFieldDef ? col.idlFieldDef.name : col.name,
661 datatype: col.datatype,
662 datePlusTime: Boolean(col.datePlusTime)
666 getObjectFieldValue(obj: any, name: string): any {
667 if (typeof obj[name] === 'function') {
674 nestedItemFieldValue(obj: any, col: GridColumn): string {
678 const original = obj;
679 const steps = col.path.split('.');
681 for (let i = 0; i < steps.length; i++) {
682 const step = steps[i];
684 if (obj === null || obj === undefined || typeof obj !== 'object') {
685 // We have run out of data to step through before
686 // reaching the end of the path. Conclude fleshing via
687 // callback if provided then exit.
688 if (col.flesher && obj !== undefined) {
689 return col.flesher(obj, col, original);
694 const class_ = obj.classname;
695 if (class_ && (idlClassDef = this.idl.classes[class_])) {
696 idlField = idlClassDef.field_map[step];
699 obj = this.getObjectFieldValue(obj, step);
702 // We found a nested IDL object which may or may not have
703 // been configured as a top-level column. Flesh the column
704 // metadata with our newly found IDL info.
707 col.datatype = idlField.datatype;
709 if (!col.idlFieldDef) {
710 idlField = col.idlFieldDef;
713 col.idlClass = idlClassDef.name;
716 col.label = idlField.label || idlField.name;
724 getColumnTextContent(row: any, col: GridColumn): string {
725 if (col.cellTemplate) {
727 // Extract the text content from the rendered template.
729 return this.getRowColumnValue(row, col);
733 selectOneRow(index: any) {
734 this.rowSelector.clear();
735 this.rowSelector.select(index);
736 this.lastSelectedIndex = index;
739 selectMultipleRows(indexes: any[]) {
740 this.rowSelector.clear();
741 this.rowSelector.select(indexes);
742 this.lastSelectedIndex = indexes[indexes.length - 1];
745 // selects or deselects an item, without affecting the others.
746 // returns true if the item is selected; false if de-selected.
747 toggleSelectOneRow(index: any) {
748 if (this.rowSelector.contains(index)) {
749 this.rowSelector.deselect(index);
753 this.rowSelector.select(index);
757 selectRowByPos(pos: number) {
758 const row = this.dataSource.data[pos];
760 this.selectOneRow(this.getRowIndex(row));
764 selectPreviousRow() {
765 if (!this.lastSelectedIndex) { return; }
766 const pos = this.getRowPosition(this.lastSelectedIndex);
767 if (pos === this.pager.offset) {
768 this.toPrevPage().then(ok => this.selectLastRow(), err => {});
770 this.selectRowByPos(pos - 1);
775 if (!this.lastSelectedIndex) { return; }
776 const pos = this.getRowPosition(this.lastSelectedIndex);
777 if (pos === (this.pager.offset + this.pager.limit - 1)) {
778 this.toNextPage().then(ok => this.selectFirstRow(), err => {});
780 this.selectRowByPos(pos + 1);
785 // Select the previous row in addition to any currently selected row.
786 // However, if the previous row is already selected, assume the user
787 // has reversed direction and now wants to de-select the last selected row.
788 selectMultiRowsPrevious() {
789 if (!this.lastSelectedIndex) { return; }
790 const pos = this.getRowPosition(this.lastSelectedIndex);
791 const selectedIndexes = this.rowSelector.selected();
793 const promise = // load the previous page of data if needed
794 (pos === this.pager.offset) ? this.toPrevPage() : Promise.resolve();
798 const row = this.dataSource.data[pos - 1];
799 const newIndex = this.getRowIndex(row);
800 if (selectedIndexes.filter(i => i === newIndex).length > 0) {
801 // Prev row is already selected. User is reversing direction.
802 this.rowSelector.deselect(this.lastSelectedIndex);
803 this.lastSelectedIndex = newIndex;
805 this.selectMultipleRows(selectedIndexes.concat(newIndex));
813 // Select the next row in addition to any currently selected row.
814 // However, if the next row is already selected, assume the user
815 // has reversed direction and wants to de-select the last selected row.
816 selectMultiRowsNext() {
817 if (!this.lastSelectedIndex) { return; }
818 const pos = this.getRowPosition(this.lastSelectedIndex);
819 const selectedIndexes = this.rowSelector.selected();
821 const promise = // load the next page of data if needed
822 (pos === (this.pager.offset + this.pager.limit - 1)) ?
823 this.toNextPage() : Promise.resolve();
827 const row = this.dataSource.data[pos + 1];
828 const newIndex = this.getRowIndex(row);
829 if (selectedIndexes.filter(i => i === newIndex).length > 0) {
830 // Next row is already selected. User is reversing direction.
831 this.rowSelector.deselect(this.lastSelectedIndex);
832 this.lastSelectedIndex = newIndex;
834 this.selectMultipleRows(selectedIndexes.concat(newIndex));
841 getFirstRowInPage(): any {
842 return this.dataSource.data[this.pager.offset];
845 getLastRowInPage(): any {
846 return this.dataSource.data[this.pager.offset + this.pager.limit - 1];
850 this.selectOneRow(this.getRowIndex(this.getFirstRowInPage()));
854 this.selectOneRow(this.getRowIndex(this.getLastRowInPage()));
858 const rows = this.dataSource.getPageOfRows(this.pager);
859 const indexes = rows.map(r => this.getRowIndex(r));
860 this.rowSelector.select(indexes);
861 this.selectRowsInPageEmitter.emit();
864 toPrevPage(): Promise<any> {
865 if (this.pager.isFirstPage()) {
866 return Promise.reject('on first');
868 // temp ignore pager events since we're calling requestPage manually.
870 this.pager.decrement();
871 this.listenToPager();
872 return this.dataSource.requestPage(this.pager);
875 toNextPage(): Promise<any> {
876 if (this.pager.isLastPage()) {
877 return Promise.reject('on last');
879 // temp ignore pager events since we're calling requestPage manually.
881 this.pager.increment();
882 this.listenToPager();
883 return this.dataSource.requestPage(this.pager);
886 getAllRows(): Promise<any> {
887 const pager = new Pager();
889 pager.limit = MAX_ALL_ROW_COUNT;
890 return this.dataSource.requestPage(pager);
893 // Returns a key/value pair object of visible column data as text.
894 getRowAsFlatText(row: any): any {
896 this.columnSet.displayColumns().forEach(col => {
898 this.getColumnTextContent(row, col);
903 getAllRowsAsText(): Observable<any> {
904 return Observable.create(observer => {
905 this.getAllRows().then(ok => {
906 this.dataSource.data.forEach(row => {
907 observer.next(this.getRowAsFlatText(row));
914 gridToCsv(): Promise<string> {
917 const columns = this.columnSet.displayColumns();
920 columns.forEach(col => {
921 csvStr += this.valueToCsv(col.label),
925 csvStr = csvStr.replace(/,$/, '\n');
927 return new Promise(resolve => {
928 this.getAllRowsAsText().subscribe(
930 columns.forEach(col => {
931 csvStr += this.valueToCsv(row[col.name]);
934 csvStr = csvStr.replace(/,$/, '\n');
937 () => resolve(csvStr)
943 // prepares a string for inclusion within a CSV document
944 // by escaping commas and quotes and removing newlines.
945 valueToCsv(str: string): string {
947 if (!str) { return ''; }
948 str = str.replace(/\n/g, '');
949 if (str.match(/\,/) || str.match(/"/)) {
950 str = str.replace(/"/g, '""');
951 str = '"' + str + '"';
957 if (!this.columnSet.idlClass) { return; }
959 const pkeyField = this.idl.classes[this.columnSet.idlClass].pkey;
961 // generate columns for all non-virtual fields on the IDL class
962 this.idl.classes[this.columnSet.idlClass].fields
963 .filter(field => !field.virtual)
965 const col = new GridColumn();
966 col.name = field.name;
967 col.label = field.label || field.name;
968 col.idlFieldDef = field;
969 col.idlClass = this.columnSet.idlClass;
970 col.datatype = field.datatype;
971 col.isIndex = (field.name === pkeyField);
974 if (this.showLinkSelectors) {
975 const selector = this.idl.getLinkSelector(
976 this.columnSet.idlClass, field.name);
978 col.path = field.name + '.' + selector;
982 this.columnSet.add(col);
986 saveGridConfig(): Promise<any> {
987 if (!this.persistKey) {
988 throw new Error('Grid persistKey required to save columns');
990 const conf = new GridPersistConf();
992 conf.limit = this.pager.limit;
993 conf.columns = this.columnSet.compileSaveObject();
995 return this.store.setItem('eg.grid.' + this.persistKey, conf);
998 // TODO: saveGridConfigAsOrgSetting(...)
1000 getGridConfig(persistKey: string): Promise<GridPersistConf> {
1001 if (!persistKey) { return Promise.resolve(null); }
1002 return this.store.getItem('eg.grid.' + persistKey);
1007 // Actions apply to specific rows
1008 export class GridToolbarAction {
1010 onClick: EventEmitter<any []>;
1011 action: (rows: any[]) => any; // DEPRECATED
1013 isGroup: boolean; // used for group placeholder entries
1014 disableOnRows: (rows: any[]) => boolean;
1017 // Buttons are global actions
1018 export class GridToolbarButton {
1020 onClick: EventEmitter<any []>;
1021 action: () => any; // DEPRECATED
1025 export class GridToolbarCheckbox {
1028 onChange: EventEmitter<boolean>;
1031 export class GridDataSource {
1035 allRowsRetrieved: boolean;
1036 getRows: (pager: Pager, sort: any[]) => Observable<any>;
1045 this.allRowsRetrieved = false;
1048 // called from the template -- no data fetching
1049 getPageOfRows(pager: Pager): any[] {
1051 return this.data.slice(
1052 pager.offset, pager.limit + pager.offset
1053 ).filter(row => row !== undefined);
1058 // called on initial component load and user action (e.g. paging, sorting).
1059 requestPage(pager: Pager): Promise<any> {
1062 this.getPageOfRows(pager).length === pager.limit
1063 // already have all data
1064 || this.allRowsRetrieved
1065 // have no way to get more data.
1068 return Promise.resolve();
1071 return new Promise((resolve, reject) => {
1072 let idx = pager.offset;
1073 return this.getRows(pager, this.sort).subscribe(
1074 row => this.data[idx++] = row,
1076 console.error(`grid getRows() error ${err}`);
1080 this.checkAllRetrieved(pager, idx);
1087 // See if the last getRows() call resulted in the final set of data.
1088 checkAllRetrieved(pager: Pager, idx: number) {
1089 if (this.allRowsRetrieved) { return; }
1091 if (idx === 0 || idx < (pager.limit + pager.offset)) {
1092 // last query returned nothing or less than one page.
1093 // confirm we have all of the preceding pages.
1094 if (!this.data.includes(undefined)) {
1095 this.allRowsRetrieved = true;
1096 pager.resultCount = this.data.length;