Skip to content

Commit

Permalink
feat(4ps): inline edit
Browse files Browse the repository at this point in the history
  • Loading branch information
develite98 committed Jan 3, 2024
1 parent d6c73d2 commit 2939a0e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export class DatabaseDataComponent
.saveData(this.dbSysName, data.id ?? -1, data)
.pipe(toastObserverProcessing(this.toast))
.subscribe((result) => {
this.store.updateData(event.rowIndex || 0, result as MixDynamicData);
this.store.updateAtIndex(event.rowIndex || 0, result as MixDynamicData);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ export class DatabaseDataStore extends ComponentStore<DatabaseDataState> {
this.patchState({ data: ObjectUtil.clone(current) });
}

public updateAtIndex(dataIndex: number, data: MixDynamicData) {
const current = this.get().data;
data[dataIndex] = data;

this.patchState({ data: current });
}

public removeData(dataId: number[]) {
let current = this.get().data;
current = current.filter((x) => !dataId.includes(x.id!));
Expand Down

1 comment on commit 2939a0e

@vercel
Copy link

@vercel vercel bot commented on 2939a0e Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.