Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROU-4896: Fix child dropdown being erased when using ApplyRowValidations #412

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 9 additions & 2 deletions src/OSFramework/DataGrid/Event/Column/ColumnEventsManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ namespace OSFramework.DataGrid.Event.Column {
* @param value Value to be passed to OS in the type of a string.
* @param rowNumber (Optional) Number of the row in which the event ocurrs.
*/
public trigger(eventType: ColumnEventType, value: string, oldValue?: string, rowNumber?: number): void {
public trigger(
eventType: ColumnEventType,
value: string,
oldValue?: string,
rowNumber?: number,
isFromApplyRowValidations = false
): void {
if (this.events.has(eventType)) {
const handlerEvent = this.events.get(eventType);

Expand All @@ -64,7 +70,8 @@ namespace OSFramework.DataGrid.Event.Column {
this._column.widgetId, // ID of the Column block in which the cell value has changed.
rowNumber, // Number of the row in which the cell value has changed.
oldValue, // Value of the cell before its value has changed (Old)
value // Value of the cell after its value has changed (New)
value, // Value of the cell after its value has changed (New)
isFromApplyRowValidations
);
break;
case ColumnEventType.OnColumnReorder:
Expand Down
11 changes: 9 additions & 2 deletions src/OSFramework/DataGrid/Event/Column/OnCellValueChange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ namespace OSFramework.DataGrid.Event.Column {
* @extends AbstractColumnEvent
*/
export class OnCellValueChange extends AbstractColumnEvent {
public trigger(gridID: string, columnID: string, rowNumber: number, oldValue: string, newValue: string): void {
public trigger(
gridID: string,
columnID: string,
rowNumber: number,
oldValue: string,
newValue: string,
isFromApplyRowValidations = false
): void {
this.handlers.slice(0).forEach((h) => {
Helper.SyncInvocation(h, gridID, rowNumber, columnID, oldValue, newValue);
Helper.SyncInvocation(h, gridID, rowNumber, columnID, oldValue, newValue, isFromApplyRowValidations);
});
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/Providers/DataGrid/Wijmo/Columns/DropdownColumn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,15 @@ namespace Providers.DataGrid.Wijmo.Column {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
oldValue: any,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
newValue: any
newValue: any,
isFromApplyRowValidations = false
): void {
if (oldValue !== newValue && oldValue.toString() !== newValue.toString()) {
this.grid.features.dirtyMark.saveOriginalValue(rowNumber, this.provider.index);
}

if (isFromApplyRowValidations) return;

const column = this.grid.getColumn(columnID);

// get current value of the child cell
Expand Down
13 changes: 8 additions & 5 deletions src/Providers/DataGrid/Wijmo/Features/ValidationMark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ namespace Providers.DataGrid.Wijmo.Feature {
column: OSFramework.DataGrid.Column.IColumn,
rowNumber: number,
newValue: string,
oldValue: string
oldValue: string,
isFromApplyRowValidations = false
): void {
if (
column.hasEvents &&
Expand All @@ -94,7 +95,8 @@ namespace Providers.DataGrid.Wijmo.Feature {
OSFramework.DataGrid.Event.Column.ColumnEventType.OnCellValueChange,
this._convertToFormat(column, newValue),
this._convertToFormat(column, oldValue),
rowNumber
rowNumber,
isFromApplyRowValidations
);
}
}
Expand Down Expand Up @@ -268,13 +270,14 @@ namespace Providers.DataGrid.Wijmo.Feature {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
oldValue: any,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
newValue: any
newValue: any,
isFromApplyRowValidations = false
) {
const column = this._grid.getColumn(columnUniqueID);

if (column !== undefined) {
this._setCellStatus(column, rowNumber, newValue);
this._handleOnCellChangeEvent(column, rowNumber, newValue, oldValue);
this._handleOnCellChangeEvent(column, rowNumber, newValue, oldValue, isFromApplyRowValidations);
}
}

Expand Down Expand Up @@ -634,7 +637,7 @@ namespace Providers.DataGrid.Wijmo.Feature {
const currValue = this._grid.provider.getCellData(rowNumber, column.provider.index, false);

// Triggers the events of OnCellValueChange associated to a specific column in OS
this._triggerEventsFromColumn(rowNumber, column.uniqueId, currValue, currValue);
this._triggerEventsFromColumn(rowNumber, column.uniqueId, currValue, currValue, true);
}
});
}
Expand Down
Loading