Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,45 @@ describe('Angular-Slickgrid Custom Component instantiated via Constructor', () =
});
});

it('should have a Custom Footer and custom texts when "showCustomFooter" is enabled with different metricTexts defined', (done) => {
const mockColDefs = [{ id: 'name', field: 'name', editor: undefined, internalColumnEditor: {} }];

component.gridOptions.enableTranslate = false;
component.gridOptions.showCustomFooter = true;
component.gridOptions.customFooterOptions = {
metricTexts: {
items: 'some items',
lastUpdate: 'some last update',
of: 'some of'
}
}
component.ngOnInit();
component.ngAfterViewInit();
component.columnDefinitions = mockColDefs;

setTimeout(() => {
expect(component.columnDefinitions).toEqual(mockColDefs);
expect(component.showCustomFooter).toBeTrue();
expect(component.customFooterOptions).toEqual({
dateFormat: 'yyyy-MM-dd hh:mm aaaaa\'m\'',
hideLastUpdateTimestamp: true,
hideTotalItemCount: false,
footerHeight: 20,
leftContainerClass: 'col-xs-12 col-sm-5',
metricSeparator: '|',
metricTexts: {
items: 'some items',
itemsKey: 'ITEMS',
lastUpdate: 'some last update',
of: 'some of',
ofKey: 'OF',
},
rightContainerClass: 'col-xs-6 col-sm-7',
});
done();
});
});

it('should NOT have a Custom Footer when "showCustomFooter" is enabled WITH Pagination in use', (done) => {
const mockColDefs = [{ id: 'name', field: 'name', editor: undefined, internalColumnEditor: {} }];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1010,14 +1010,14 @@ export class AngularSlickgridComponent implements AfterViewInit, OnDestroy, OnIn
*/
private optionallyShowCustomFooterWithMetrics() {
if (this.gridOptions) {
if ((this.gridOptions.enableTranslate || this.gridOptions.i18n)) {
if (this.gridOptions.enableTranslate) {
this.translateCustomFooterTexts();
} else if (this.gridOptions.customFooterOptions) {
const customFooterOptions = this.gridOptions.customFooterOptions;
customFooterOptions.metricTexts = customFooterOptions.metricTexts || {};
customFooterOptions.metricTexts.lastUpdate = this.locales && this.locales.TEXT_LAST_UPDATE || 'TEXT_LAST_UPDATE';
customFooterOptions.metricTexts.items = this.locales && this.locales.TEXT_ITEMS || 'TEXT_ITEMS';
customFooterOptions.metricTexts.of = this.locales && this.locales.TEXT_OF || 'TEXT_OF';
customFooterOptions.metricTexts.lastUpdate = customFooterOptions.metricTexts.lastUpdate || this.locales && this.locales.TEXT_LAST_UPDATE || 'TEXT_LAST_UPDATE';
customFooterOptions.metricTexts.items = customFooterOptions.metricTexts.items || this.locales && this.locales.TEXT_ITEMS || 'TEXT_ITEMS';
customFooterOptions.metricTexts.of = customFooterOptions.metricTexts.of || this.locales && this.locales.TEXT_OF || 'TEXT_OF';
}

// we will display the custom footer only when there's no Pagination
Expand Down