Posted 23 June 2020, 2:10 am EST
Dear Wijmo team,
I’m using Angular 8 and Wijmo version 5.20193.637.
When trying to duplicate a row while a cell of that row is selected for editing (double click on cell, then right click on the same cell to open context menu) this.data.addNew() returns null, but the new row is still being created.
Context Menu
<wj-menu #ctxMenu style="display:none" [header]="'Context Menu'" [selectedValuePath]="'cmd'"
[dropDownCssClass]="'ctx-menu'">
<wj-menu-item [cmd]="cmdCopy">
<span class="glyphicon wj-glyph-file"></span> Zeile kopieren
</wj-menu-item>
</wj-menu>
cmdCopy()
cmdCopy = {
canExecuteCommand: () => {
return this.flexdata && this.flexdata.selectedRows && this.flexdata.selectedRows.length > 0 &&
this.canCreate()
},
executeCommand: () => {
let flexIndex = this.flexdata.selectedRows[0].index;
let rowsData = this.flexdata.rows[flexIndex].dataItem;
this.copyIntoNew(rowsData);
}
};
async copyIntoNew(data: any) {
let newitem = this.data.addNew();
this.selectedKatalogwert = newitem;
Object.keys(newitem['attributWerte']).forEach(key => {
...
});
this.flexdata.select(new CellRange(0, 0, 0, 0));
let newSelectIndex = 0;
this.flexdata.rows.forEach((r, i) => {
if (r.dataItem.guid === newitem.guid) {
newSelectIndex = i;
}
});
this.flexdata.select(new CellRange(newSelectIndex, 0));
}
Calling newitem[‘attributWerte’] produces a typescript error.
Why does this happen?
Best regards
Moritz