Posted 14 September 2017, 3:12 am EST
Thank you Manish for quick replying. I have copied and tried your code. It is working like a charm. However, When I tried to change it to ionic’s style by seperating ts and html: This is what I did:
TS:
contextMenu(event) {
let ht = this.flex.hitTest(event);
if (ht.cellType !== wjGrid.CellType.ColumnHeader) {
event.preventDefault();
event.stopImmediatePropagation();
}
}
HTML:
<ion-content padding>
<wj-flex-grid
#flex [itemsSource]=“dataCollection”
[autoGenerateColumns]=“true”
[headersVisibility]=“1”
[isReadOnly]=“true”
(contextmenu)=“contextMenu($event)”
[wjContextMenu]=“ctxMenu”>
</wj-flex-grid>
<wj-menu
#ctxMenu
style=“display:none;”
[header] = “‘Main Menu Test’”
(itemClicked)=“menuItemClicked(ctxMenu, $event)”>
<wj-menu-item [value]="'AutoSizeColum'">Auto Size Column</wj-menu-item>
<wj-menu-item [value]="'AutoSizeRow'">Auto Size Row</wj-menu-item>
<wj-menu-separator></wj-menu-separator>
<wj-menu-item [value]="'ExportExcel'">Export Excel</wj-menu-item>
<wj-menu-item [value]="'ExportPDF'">Export PDF</wj-menu-item>
<wj-menu-separator></wj-menu-separator>
<wj-menu-item [value]="'Print'">Print</wj-menu-item>
<wj-menu-separator></wj-menu-separator>
<wj-menu-item [value]="'Grouping'">Grouping</wj-menu-item>
<wj-menu-item [value]="'People'">People</wj-menu-item>
<wj-menu-item [value]="'Productivity'">Productivity</wj-menu-item>
<wj-menu-separator></wj-menu-separator>
<wj-menu-item [value]="'FreezePanes'">Freeze Panes</wj-menu-item>
</wj-menu>
</ion-content>
It executed through contextMenu(e) function but did not prevent it from popping up on column header only. I checked futher and added
event.returnValue = true;
contextMenu(event) {
let ht = this.flex.hitTest(event);
if (ht.cellType !== wjGrid.CellType.ColumnHeader) {
event.preventDefault();
event.stopImmediatePropagation();
event.returnValue = true;
}
}
to it. It worked parttilally because the contecxt’s menu still show but under the browser’s menu. I guessed I miss another parameter to set. What I am missing here sir?
https://www.dropbox.com/s/wyn1426z2ri4ht8/wijmoTest.7z?dl=0