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

Commit fcbb63f

Browse files
committed
chore: improve unsaved CSS styling code
1 parent da86a2d commit fcbb63f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/app/examples/grid-composite-editor.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -687,11 +687,11 @@ export class GridCompositeEditorComponent implements OnInit {
687687

688688
renderUnsavedCellStyling(item: any, column: Column, editCommand: EditCommand) {
689689
if (editCommand && item && column) {
690-
const row = this.angularGrid.dataView.getRowByItem(item) as number;
691-
if (row >= 0) {
690+
const row = this.angularGrid.dataView?.getRowByItem(item);
691+
if (row !== undefined && row >= 0) {
692692
const hash = { [row]: { [column.id]: 'unsaved-editable-field' } };
693693
const cssStyleKey = `unsaved_highlight_${[column.id]}${row}`;
694-
this.angularGrid.slickGrid.setCellCssStyles(`unsaved_highlight_${[column.id]}${row}`, hash);
694+
this.angularGrid.slickGrid.setCellCssStyles(cssStyleKey, hash);
695695
this.cellCssStyleQueue.push(cssStyleKey);
696696
}
697697
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ export class AngularSlickgridComponent<TData = any> implements AfterViewInit, On
582582

583583
// if you don't want the items that are not visible (due to being filtered out or being on a different page)
584584
// to stay selected, pass 'false' to the second arg
585-
if (this.slickGrid?.getSelectionModel() && this.gridOptions && this.gridOptions.dataView && this.gridOptions.dataView.hasOwnProperty('syncGridSelection')) {
585+
if (this.slickGrid?.getSelectionModel() && this.gridOptions?.dataView?.hasOwnProperty('syncGridSelection')) {
586586
// if we are using a Backend Service, we will do an extra flag check, the reason is because it might have some unintended behaviors
587587
// with the BackendServiceApi because technically the data in the page changes the DataView on every page change.
588588
let preservedRowSelectionWithBackend = false;

0 commit comments

Comments
 (0)