Skip to content

Commit

Permalink
fix(core): add missing inlineFilters DataView optional flag (#551)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding committed Aug 3, 2020
1 parent 3941ba7 commit a5ae4da
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ describe('Angular-Slickgrid Custom Component instantiated via Constructor', () =
component.ngAfterViewInit();

expect(extensionSpy).toHaveBeenCalledWith('groupItemMetaProvider');
expect(dataviewSpy).toHaveBeenCalledWith({ groupItemMetadataProvider: expect.anything() });
expect(dataviewSpy).toHaveBeenCalledWith({ groupItemMetadataProvider: expect.anything(), inlineFilters: false });
expect(groupMetaSpy).toHaveBeenCalledWith();
expect(sharedMetaSpy).toHaveBeenCalledWith(mockGroupItemMetaProvider);

Expand All @@ -476,7 +476,7 @@ describe('Angular-Slickgrid Custom Component instantiated via Constructor', () =
component.ngAfterViewInit();

expect(extensionSpy).toHaveBeenCalledWith('groupItemMetaProvider');
expect(dataviewSpy).toHaveBeenCalledWith({ groupItemMetadataProvider: expect.anything() });
expect(dataviewSpy).toHaveBeenCalledWith({ groupItemMetadataProvider: expect.anything(), inlineFilters: false });
expect(groupMetaSpy).toHaveBeenCalledWith();
expect(sharedMetaSpy).toHaveBeenCalledWith(mockGroupItemMetaProvider);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
Column,
ColumnEditor,
CustomFooterOption,
ExtensionList,
DataViewOption,
ExtensionName,
GraphqlPaginatedResult,
GraphqlResult,
Expand Down Expand Up @@ -729,14 +729,16 @@ export class AngularSlickgridComponent implements AfterViewInit, OnDestroy, OnIn
this._isLocalGrid = !this.backendServiceApi; // considered a local grid if it doesn't have a backend service set

if (!this.customDataView) {
const dataviewInlineFilters = this.gridOptions.dataView && this.gridOptions.dataView.inlineFilters || false;
let dataViewOptions: DataViewOption = { inlineFilters: dataviewInlineFilters };

if (this.gridOptions.draggableGrouping || this.gridOptions.enableGrouping) {
this.extensionUtility.loadExtensionDynamically(ExtensionName.groupItemMetaProvider);
this.groupItemMetadataProvider = new Slick.Data.GroupItemMetadataProvider();
this.sharedService.groupItemMetadataProvider = this.groupItemMetadataProvider;
this.dataView = new Slick.Data.DataView({ groupItemMetadataProvider: this.groupItemMetadataProvider });
} else {
this.dataView = new Slick.Data.DataView();
dataViewOptions = { ...dataViewOptions, groupItemMetadataProvider: this.groupItemMetadataProvider };
}
this.dataView = new Slick.Data.DataView(dataViewOptions);
}

// for convenience to the user, we provide the property "editor" as an Angular-Slickgrid editor complex object
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export interface DataViewOption {
/** Defaults to false, use with great care as this will break built-in filters */
inlineFilters?: boolean;

/** Optionally provide a Group Item Metatadata Provider when using Grouping/DraggableGrouping feature */
groupItemMetadataProvider?: any;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ColumnPicker,
ColumnReorderFunction,
ContextMenu,
DataViewOption,
DraggableGrouping,
EditCommand,
ExcelCopyBufferOption,
Expand Down Expand Up @@ -117,7 +118,7 @@ export interface GridOption {
datasetIdPropertyName?: string;

/** Some of the SlickGrid DataView options */
dataView?: {
dataView?: DataViewOption & {
/**
* Defaults to true, when using row selection,
* if you don't want the items that are not visible (due to being filtered out or being on a different page) to stay selected,
Expand Down
1 change: 1 addition & 0 deletions src/app/modules/angular-slickgrid/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export * from './currentPagination.interface';
export * from './currentRowSelection.interface';
export * from './currentSorter.interface';
export * from './customFooterOption.interface';
export * from './dataViewOption.interface';
export * from './delimiterType.enum';
export * from './draggableGrouping.interface';
export * from './editCommand.interface';
Expand Down

0 comments on commit a5ae4da

Please sign in to comment.