Posted 13 December 2019, 12:30 am EST - Updated 3 October 2022, 6:33 pm EST
Hi,
I’m getting an error while trying to paste from excel.
Here, the code I use
<wj-flex-sheet #formatSheet (initialized)="formatSheetInit(formatSheet)"
(selectionChanged)="onSelectionChanged(formatSheet,$event)"
(cellEditEnded)="onSelectionChanged(formatSheet,$event)"
(cellEditEnding)="onCellEditEnding(formatSheet,$event)"
(rowEditStarting)="rowEditStarting(formatSheet ,$event)"
(contextmenu)="onRightClick($event)"
[wjContextMenu]="ctmenu"
(updatingView)="onUpdatingView(formatSheet)" (pasted)="updateSheet(formatSheet, $event)"
style="margin:0px;border:0px;width:100%;height:77vh;padding:0">
<wj-sheet [itemsSource]="source" name="{{sheetTitle}}"></wj-sheet>
</wj-flex-sheet><br>
updateSheet(s, e) {
console.log("UPDATE SHEET");
var updatedData: string = JSON.stringify(this.source.sourceCollection);
if (this.isImportExcel) {
const newData = this.getImportedCVData();
console.log("NEW DATAAAAAAAAAAAAAAAAAAAAAAAAAAA");
console.log(newData);
this.source.sourceCollection = newData;
updatedData = String(JSON.stringify(this.source.sourceCollection).replace(/'/g, ""));
}
this.apiService.saveSheet(this.idGrid, updatedData).subscribe(res => {
var resp: any = res;
console.log(res);
if (resp.success) {
this.socket.emit('sheet', {
data: this.formatSheet.getCellData(e.row, e.col, false),
id: this.idGrid,
row: e.row,
column: e.col
}, function (data) {
console.log("NEW DATA !!");
});
}
}, err => {
console.log(err);
});
this.checkEditedCell = false; // Assign False Edited
}
Could you please help me with that ?
Thanks,
Oskar Putra