Skip to content
Open
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 @@ -956,15 +956,7 @@ export class DataController extends modules.Controller {
const oldValue = oldRow.values[columnIndex];
const newValue = newRow.values[columnIndex];

if (JSON.stringify(oldValue) !== JSON.stringify(newValue)) {
return true;
}

const isCellModified = (
row: ProcessedItem,
): boolean => row.modifiedValues?.[columnIndex] !== undefined;

return isCellModified(oldRow) !== isCellModified(newRow);
return JSON.stringify(oldValue) !== JSON.stringify(newValue);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,14 @@ describe('Editing data controller row changes', () => {
expect(change.changeTypes).toEqual(['update']);
},
);

it('should report a cell whose modified mark appeared without a new value', async () => {
const change = await refreshRow(
dataRow(),
dataRow({ modified: true, modifiedValues: [undefined, 15] }),
);

expect(change.rowIndices).toEqual([0]);
expect(change.columnIndices).toEqual([[1]]);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import gridCoreUtils from '@ts/grids/grid_core/m_utils';

import { EDITING_EDITROWKEY_OPTION_NAME } from '../const';
import type { EditingController } from '../m_editing';
import { isCellModified } from '../m_editing_utils';

export interface EditingDataControllerExtension {
_editingController: EditingController;
Expand Down Expand Up @@ -147,6 +148,10 @@ export const editingDataControllerExtender = (
return true;
}

if (isCellModified(oldRow, columnIndex) !== isCellModified(newRow, columnIndex)) {
return true;
}

return super._isCellChanged(oldRow, newRow, visibleRowIndex, columnIndex, isLiveUpdate);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Guid from '@js/core/guid';
import { isObject } from '@js/core/utils/type';

import type { ProcessedItem } from '../data_controller/types';

const NEW_ROW_TEMP_KEY_PREFIX = '_DX_KEY_';
const GUID_LENGTH = 36;

Expand Down Expand Up @@ -80,3 +82,8 @@ export const forEachFormItems = (items, callBack) => {
}
});
};

export const isCellModified = (
row: ProcessedItem,
columnIndex: number,
): boolean => row.modifiedValues?.[columnIndex] !== undefined;
Loading