Fix context menus in grids (#2245)

* fix context menus

* fix edit data context menu
This commit is contained in:
Anthony Dresser
2018-08-16 17:34:52 -07:00
committed by Karl Burtram
parent 173842510c
commit a8f21b56f0
2 changed files with 20 additions and 15 deletions

View File

@@ -228,8 +228,12 @@ export abstract class GridParentComponent {
protected getSelection(index?: number): ISlickRange[] {
let selection = this.slickgrids.toArray()[index || this.activeGrid].getSelectedRanges();
selection = selection.map(c => { return <ISlickRange>{ fromCell: c.fromCell - 1, toCell: c.toCell - 1, toRow: c.toRow, fromRow: c.fromRow }; });
return selection;
if (selection) {
selection = selection.map(c => { return <ISlickRange>{ fromCell: c.fromCell - 1, toCell: c.toCell - 1, toRow: c.toRow, fromRow: c.fromRow }; });
return selection;
} else {
return undefined;
}
}
private copySelection(): void {

View File

@@ -15,19 +15,20 @@
(focusin)="onGridFocus()" (focusout)="onGridFocusout()">
<div class="boxRow content horzBox slickgrid" *ngFor="let dataSet of renderedDataSets; let i = index"
[style.max-height]="dataSet.maxHeight" [style.min-height]="dataSet.minHeight">
<slick-grid #slickgrid id="slickgrid_{{i}}" [columnDefinitions]="dataSet.columnDefinitions"
[ngClass]="i === activeGrid ? 'active' : ''"
[dataRows]="dataSet.dataRows"
(contextMenu)="openContextMenu($event, dataSet.batchId, dataSet.resultId, i)"
enableAsyncPostRender="true"
showHeader="true"
[resized]="dataSet.resized"
(onActiveCellChanged)="onActiveCellChanged(i)"
(mousedown)="navigateToGrid(i)"
[selectionModel]="selectionModel"
[plugins]="plugins[i]"
class="boxCol content vertBox slickgrid"
[rowHeight]="rowHeight">
<slick-grid #slickgrid id="slickgrid_{{i}}"
class="boxCol content vertBox slickgrid"
enableAsyncPostRender="true"
showHeader="true"
[columnDefinitions]="dataSet.columnDefinitions"
[ngClass]="i === activeGrid ? 'active' : ''"
[dataRows]="dataSet.dataRows"
[resized]="dataSet.resized"
[selectionModel]="selectionModel"
[plugins]="plugins[i]"
[rowHeight]="rowHeight"
(onContextMenu)="openContextMenu($event, dataSet.batchId, dataSet.resultId, i)"
(onActiveCellChanged)="onActiveCellChanged(i)"
(mousedown)="navigateToGrid(i)">
</slick-grid>
<span class="boxCol content vertBox">
<div class="boxRow content maxHeight" *ngFor="let icon of dataIcons">