Context Menu on PivotView Cells

Hi Team

I have implemented a PivotView as defined in this https://stackblitz.com/edit/angular-iqe2sr-qkaerq example.
Is there any way I can get context menu on each cell?

I want to get the cell values / cell information object on context menu click.

3 Replies

MM Manikandan Murugesan Syncfusion Team February 24, 2020 10:32 AM UTC

Hi Shreekumar, 

We have prepared a sample as per your requirement. 


You can get information about each cell in the “contextMenuClick” event as shown in the following code snippet. 

Code Snippet: 
this.gridSettings = { 
    columnWidth: 140, 
          contextMenuItems: [{ text: 'Formatted Value'id: 'formattedValue'target: 'td.e-valuescontent' }, 
          { text: 'Row Header'id: 'rowHeaderForValue'target: 'td.e-valuescontent' }, 
          { text: 'Column Header'id: 'columnHeaderForValue'target: 'td.e-valuescontent' }, 
           { text: 'Exit'id: 'close'target: 'td.e-valuescontent,th.e-columnsheader,td.e-rowsheader' }], 
          contextMenuClick: this.observable.subscribe(args => { 
            if ((args as any).item.id === 'formattedValue') { 
              console.log((args as any).rowInfo.rowData[(args as any).rowInfo.cellIndex].formattedText); 
            } else if ((args as any).item.id === 'rowHeaderForValue') { 
              console.log((args as any).rowInfo.rowData[(args as any).rowInfo.cellIndex].rowHeaders); 
            } else if ((args as any).item.id === 'columnHeaderForValue') { 
              console.log((args as any).rowInfo.rowData[(args as any).rowInfo.cellIndex].columnHeaders); 
            } 
          }) as any, 
  } as GridSettings; 
 
 


If this is different from your requirement, then please let us know the more details with screen shot/video (if possible), so that we can work towards fulfilling your requirement. 
 
Thanks, 
Manikandan. 



SH Shreekumar February 24, 2020 02:08 PM UTC

This is what I wanted. Thank you for quick turnaround. 


SN Sivamathi Natarajan Syncfusion Team February 25, 2020 04:46 AM UTC

Hi Shreekumar, 
 
Thanks for the response. Please get in touch with us if you would require any further assistance. 
Regards, 
Sivamathi. 


Loader.
Up arrow icon