Skip to content

Commit

Permalink
fix(pagination): able to change translate pubsub event name in component
Browse files Browse the repository at this point in the history
- also fix a small issue found where set pagination presets was being called more than once
- also dispose of slick empty component when disposing of vanilla bundle
  • Loading branch information
ghiscoding committed Jul 6, 2021
1 parent 00f2db2 commit 4745063
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ export class SlickPaginationComponent {
this.translatePaginationTexts(this._locales);

if (this._enableTranslate && this.pubSubService && this.pubSubService.subscribe) {
const translateEventName = this.translaterService?.eventName ?? 'onLanguageChange';
this._subscriptions.push(
this.pubSubService.subscribe('onLanguageChange', () => this.translatePaginationTexts(this._locales))
this.pubSubService.subscribe(translateEventName, () => this.translatePaginationTexts(this._locales))
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ export class SlickVanillaGridBundle {

// dispose the Components
this.slickFooter?.dispose();
this.slickEmptyWarning?.dispose();
this.slickPagination?.dispose();

this._eventPubSubService?.unsubscribeAll();
Expand Down Expand Up @@ -1117,7 +1118,7 @@ export class SlickVanillaGridBundle {
* if there are then load them in the paginationOptions object
*/
setPaginationOptionsWhenPresetDefined(gridOptions: GridOption, paginationOptions: Pagination): Pagination {
if (gridOptions.presets?.pagination && gridOptions.pagination) {
if (gridOptions.presets?.pagination && paginationOptions && !this._isPaginationInitialized) {
paginationOptions.pageSize = gridOptions.presets.pagination.pageSize;
paginationOptions.pageNumber = gridOptions.presets.pagination.pageNumber;
}
Expand Down

0 comments on commit 4745063

Please sign in to comment.