Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit cbc6f90

Browse files
Ghislain BeaulacGhislain Beaulac
Ghislain Beaulac
authored and
Ghislain Beaulac
committed
feat(query): add excludeFromQuery prop and use it for Row Selection
1 parent 349aaca commit cbc6f90

File tree

6 files changed

+16
-2
lines changed

6 files changed

+16
-2
lines changed

src/app/examples/grid-graphql.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ export class GridGraphqlComponent implements OnInit {
6767
enableAutoResize: false,
6868
enableFiltering: true,
6969
enableCellNavigation: true,
70+
enableCheckboxSelector: true,
71+
enableRowSelection: true,
7072
enableTranslate: true,
7173
pagination: {
7274
pageSizes: [10, 15, 20, 25, 30, 40, 50, 75, 100],

src/app/examples/grid-odata.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ export class GridOdataComponent implements OnInit {
5555
containerId: 'demo-container',
5656
sidePadding: 15
5757
},
58-
enableFiltering: true,
5958
enableCellNavigation: true,
59+
enableFiltering: true,
60+
enableCheckboxSelector: true,
61+
enableRowSelection: true,
6062
pagination: {
6163
pageSizes: [10, 15, 20, 25, 30, 40, 50, 75, 100],
6264
pageSize: defaultPageSize,

src/app/modules/angular-slickgrid/models/column.interface.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export interface Column {
2929
/** Default to false, do we want this column excluded from the export? */
3030
excludeFromExport?: boolean;
3131

32+
/** Defaults to false, do we want to exclude this field from the query (mostly a backend service query) */
33+
excludeFromQuery?: boolean;
34+
3235
/**
3336
* Export with a Custom Formatter, useful when we want to use a different Formatter for the export.
3437
* For example, we might have a boolean field with "Formatters.checkmark" but we would like see a translated value for (True/False).

src/app/modules/angular-slickgrid/services/controlAndPlugin.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ export class ControlAndPluginService {
503503
this.checkboxSelectorPlugin = new Slick.CheckboxSelectColumn(options.checkboxSelector || {});
504504
const selectionColumn: Column = this.checkboxSelectorPlugin.getColumnDefinition();
505505
selectionColumn.excludeFromExport = true;
506+
selectionColumn.excludeFromQuery = true;
506507
columnDefinitions.unshift(selectionColumn);
507508
}
508509
}

src/app/modules/angular-slickgrid/services/graphql.service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ export class GraphqlService implements BackendService {
5858
if (!this.options || !this.options.datasetName || (!this._columnDefinitions && !this.options.columnDefinitions)) {
5959
throw new Error('GraphQL Service requires "datasetName" & "columnDefinitions" properties for it to work');
6060
}
61-
const columnDefinitions = this._columnDefinitions || this.options.columnDefinitions;
61+
62+
// get the column definitions and exclude some if they were tagged as excluded
63+
let columnDefinitions = this._columnDefinitions || this.options.columnDefinitions;
64+
columnDefinitions = columnDefinitions.filter((column: Column) => !column.excludeFromQuery);
65+
6266
const queryQb = new QueryBuilder('query');
6367
const datasetQb = new QueryBuilder(this.options.datasetName);
6468
const pageInfoQb = new QueryBuilder('pageInfo');

src/app/modules/angular-slickgrid/services/grid-odata.service.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ export class GridOdataService implements BackendService {
6060

6161
if (grid && grid.getColumns && grid.getOptions) {
6262
this._columnDefinitions = grid.getColumns() || options.columnDefinitions;
63+
this._columnDefinitions = this._columnDefinitions.filter((column: Column) => !column.excludeFromQuery);
64+
6365
this._gridOptions = grid.getOptions();
6466
}
6567
}

0 commit comments

Comments
 (0)