Skip to content

Commit

Permalink
fix(plugin): CustomDataView for CellSelectionModel & SlickCustomToolt…
Browse files Browse the repository at this point in the history
…ip (#1306)

* fix(plugin): CellSelectionModel should work w/CustomDataView
  • Loading branch information
ghiscoding authored Jan 6, 2024
1 parent a993ef7 commit 3bdd300
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions packages/common/src/extensions/slickCellSelectionModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { isDefined } from '@slickgrid-universal/utils';

import { type SlickDataView, SlickEvent, SlickEventData, SlickEventHandler, SlickRange, type SlickGrid } from '../core/index';
import type { SelectionModel } from '../enums/index';
import type { OnActiveCellChangedEventArgs } from '../interfaces/index';
import type { CustomDataView, OnActiveCellChangedEventArgs } from '../interfaces/index';
import { SlickCellRangeSelector } from './index';

export interface CellSelectionModelOption {
Expand All @@ -17,7 +17,7 @@ export class SlickCellSelectionModel implements SelectionModel {
protected _addonOptions?: CellSelectionModelOption;
protected _cachedPageRowCount = 0;
protected _eventHandler: SlickEventHandler;
protected _dataView?: SlickDataView;
protected _dataView?: CustomDataView | SlickDataView;
protected _grid!: SlickGrid;
protected _prevSelectedRow?: number;
protected _prevKeyDown = '';
Expand Down Expand Up @@ -52,7 +52,7 @@ export class SlickCellSelectionModel implements SelectionModel {
init(grid: SlickGrid) {
this._grid = grid;
if (grid.hasDataView()) {
this._dataView = grid?.getData() ?? {} as SlickDataView;
this._dataView = grid.getData<CustomDataView | SlickDataView>();
}
this._addonOptions = { ...this._defaults, ...this._addonOptions } as CellSelectionModelOption;

Expand Down Expand Up @@ -184,7 +184,7 @@ export class SlickCellSelectionModel implements SelectionModel {
const active = this._grid.getActiveCell();

let dataLn = 0;
if (this._dataView) {
if (this._dataView && 'getPagingInfo' in this._dataView) {
dataLn = this._dataView?.getPagingInfo().pageSize || this._dataView.getLength();
} else {
dataLn = this._grid.getDataLength();
Expand Down
6 changes: 3 additions & 3 deletions packages/custom-tooltip-plugin/src/slickCustomTooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type {
CancellablePromiseWrapper,
Column,
ContainerService,
CustomDataView,
CustomTooltipOption,
DOMEvent,
Formatter,
Expand All @@ -11,7 +12,6 @@ import type {
Observable,
RxJsFacade,
SharedService,
SlickDataView,
SlickGrid,
Subscription,
} from '@slickgrid-universal/common';
Expand Down Expand Up @@ -96,8 +96,8 @@ export class SlickCustomTooltip {
get className(): string {
return this._cellAddonOptions?.className ?? 'slick-custom-tooltip';
}
get dataView(): SlickDataView {
return this._grid.getData<SlickDataView>() || {};
get dataView(): CustomDataView {
return this._grid.getData<CustomDataView>() || {};
}

/** Getter for the Grid Options pulled through the Grid Object */
Expand Down

0 comments on commit 3bdd300

Please sign in to comment.