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

Commit 5096c03

Browse files
Ghislain BeaulacGhislain Beaulac
authored andcommitted
fix(grouping): Grouping with Filter should work together, closes #57
1 parent a4209d7 commit 5096c03

File tree

3 files changed

+73
-9
lines changed

3 files changed

+73
-9
lines changed

ISSUE_TEMPLATE.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!--
2+
BUGS: Please use this template.
3+
4+
The HTML comments below are for your reference, and are not displayed
5+
when your issue is submitted, feel free to leave them.
6+
7+
CHOOSE the relevant headings, DELETE the other(s).
8+
-->
9+
**I'm submitting a bug report**
10+
**I'm submitting a feature request**
11+
12+
* **Library Version:**
13+
major.minor.patch
14+
15+
<!--
16+
If you think the environment might have an influence then please provide
17+
else you can omit.
18+
-->
19+
**Please tell us about your environment:**
20+
* **Operating System:**
21+
OSX 10.x|Linux (distro)|Windows [7|8|8.1|10]
22+
23+
24+
* **Browser:**
25+
all | Chrome XX | Firefox XX | Edge XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView
26+
27+
* **Language:**
28+
TypeScript X.X
29+
30+
31+
**Current behavior:**
32+
33+
34+
**Expected/desired behavior:**
35+
36+
37+
* **What is the expected behavior?**
38+
39+
40+
* **What is the motivation / use case for changing the behavior?**

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

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
Aggregators,
55
Column,
66
FieldType,
7+
Filters,
78
Formatters,
89
GridOption,
910
GroupTotalFormatters,
@@ -51,6 +52,7 @@ export class GridGroupingComponent implements OnInit, OnDestroy {
5152
id: 'sel', name: '#', field: 'num', width: 40,
5253
maxWidth: 70,
5354
resizable: true,
55+
filterable: true,
5456
selectable: false,
5557
focusable: false
5658
},
@@ -59,11 +61,14 @@ export class GridGroupingComponent implements OnInit, OnDestroy {
5961
width: 50,
6062
minWidth: 50,
6163
cssClass: 'cell-title',
64+
filterable: true,
6265
sortable: true
6366
},
6467
{
6568
id: 'duration', name: 'Duration', field: 'duration',
6669
minWidth: 50, width: 60,
70+
filterable: true,
71+
filter: { model: Filters.slider, operator: '>=' },
6772
sortable: true,
6873
type: FieldType.number,
6974
groupTotalsFormatter: GroupTotalFormatters.sumTotals,
@@ -73,40 +78,62 @@ export class GridGroupingComponent implements OnInit, OnDestroy {
7378
id: '%', name: '% Complete', field: 'percentComplete',
7479
minWidth: 70, width: 90,
7580
formatter: Formatters.percentCompleteBar,
81+
filterable: true,
82+
filter: { model: Filters.compoundSlider },
7683
sortable: true,
7784
groupTotalsFormatter: GroupTotalFormatters.avgTotalsPercentage,
7885
params: { groupFormatterPrefix: '<i>Avg</i>: ' }
7986
},
8087
{
8188
id: 'start', name: 'Start', field: 'start',
8289
minWidth: 60,
90+
filterable: true,
91+
filter: { model: Filters.compoundDate },
8392
sortable: true,
93+
type: FieldType.dateIso,
8494
formatter: Formatters.dateIso,
8595
exportWithFormatter: true
8696
},
8797
{
8898
id: 'finish', name: 'Finish', field: 'finish',
8999
minWidth: 60,
100+
filterable: true,
101+
filter: { model: Filters.compoundDate },
90102
sortable: true,
103+
type: FieldType.dateIso,
91104
formatter: Formatters.dateIso,
92105
exportWithFormatter: true
93106
},
94107
{
95108
id: 'cost', name: 'Cost', field: 'cost',
96109
minWidth: 70,
97110
width: 100,
111+
filterable: true,
112+
filter: { model: Filters.compoundInput },
113+
type: FieldType.number,
98114
sortable: true,
99115
exportWithFormatter: true,
100116
formatter: Formatters.dollar,
101-
groupTotalsFormatter: GroupTotalFormatters.sumTotals,
102-
params: { groupFormatterPrefix: '<b>Total</b>: $' /*, groupFormatterSuffix: ' USD'*/ }
117+
groupTotalsFormatter: GroupTotalFormatters.sumTotalsDollar,
118+
params: { groupFormatterPrefix: '<b>Total</b>: ' /*, groupFormatterSuffix: ' USD'*/ }
103119
},
104120
{
105121
id: 'effort-driven', name: 'Effort Driven',
106122
minWidth: 20, width: 80, maxWidth: 80,
107123
cssClass: 'cell-effort-driven',
108124
field: 'effortDriven',
109-
formatter: Formatters.checkmark, sortable: true
125+
formatter: Formatters.checkmark,
126+
sortable: true,
127+
filterable: true,
128+
filter: {
129+
collection: [{ value: '', label: '' }, { value: true, label: 'True' }, { value: false, label: 'False' }],
130+
model: Filters.singleSelect,
131+
132+
// we could add certain option(s) to the "multiple-select" plugin
133+
filterOptions: {
134+
autoDropWidth: true
135+
},
136+
}
110137
}
111138
];
112139

@@ -115,6 +142,7 @@ export class GridGroupingComponent implements OnInit, OnDestroy {
115142
containerId: 'demo-container',
116143
sidePadding: 15
117144
},
145+
enableFiltering: true,
118146
enableGrouping: true,
119147
exportOptions: {
120148
sanitizeDataExport: true

src/app/modules/angular-slickgrid/components/angular-slickgrid.component.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import 'jquery-ui-dist/jquery-ui';
33
import 'slickgrid/lib/jquery.event.drag-2.3.0';
44
import 'slickgrid/slick.core';
5-
import 'slickgrid/slick.dataview';
65
import 'slickgrid/slick.grid';
76
import 'slickgrid/slick.dataview';
87
import 'slickgrid/slick.groupitemmetadataprovider';
@@ -184,10 +183,7 @@ export class AngularSlickgridComponent implements AfterViewInit, OnDestroy, OnIn
184183

185184
if (this.gridOptions.enableGrouping) {
186185
this.groupItemMetadataProvider = new Slick.Data.GroupItemMetadataProvider();
187-
this._dataView = new Slick.Data.DataView({
188-
groupItemMetadataProvider: this.groupItemMetadataProvider,
189-
inlineFilters: true
190-
});
186+
this._dataView = new Slick.Data.DataView({ groupItemMetadataProvider: this.groupItemMetadataProvider });
191187
} else {
192188
this._dataView = new Slick.Data.DataView();
193189
}
@@ -278,7 +274,7 @@ export class AngularSlickgridComponent implements AfterViewInit, OnDestroy, OnIn
278274

279275
/**
280276
* Define what our internal Post Process callback, it will execute internally after we get back result from the Process backend call
281-
* For now, this is GraphQL Service only feautre and it will basically refresh the Dataset & Pagination without having the user to create his own PostProcess every time
277+
* For now, this is GraphQL Service only feature and it will basically refresh the Dataset & Pagination without having the user to create his own PostProcess every time
282278
*/
283279
createBackendApiInternalPostProcessCallback(gridOptions: GridOption) {
284280
if (gridOptions && gridOptions.backendServiceApi) {

0 commit comments

Comments
 (0)