How to add custom context menu in angular spreadsheet headers

Hey Syncfusion Team,


I'm using Angular Spreadsheet component and I want to show a custom context to the user on left mouse click on spreadhsheet headers and hence it will replace the default full column select feature of spreadsheet component.
Can you please provide a demo how to do this?


Thanks and Regards,

Vivek SInghal


3 Replies 1 reply marked as answer

TS Thaneegairaj Sankar Syncfusion Team January 26, 2022 04:40 PM UTC

Hi Vivek, 
 
We can able to achieve your requirement in spreadsheet by using beforeSelect event. Please find the below code example, 
 
beforeSelect(args) { 
    let indexes = getRangeIndexes(args.range); 
    if (indexes[0] === 0 && indexes[2] >= 99 && indexes[1] === indexes[3]) { 
      args.cancel = true; 
      const left = this.spreadsheetObj.getCell(0, indexes[1]).offsetLeft + 39; // row header width 30px + body padding 8px; 
      const top = this.spreadsheetObj.element.querySelector('.e-sheet').offsetTop + this.spreadsheetObj.element.querySelector('.e-column-header').offsetHeight; 
      this.contextmenuObj.open(top, left);  
    } 
  } 
 
For your reference we have prepared a sample, please find the below link. 
 
 
Could you please check the above details and get back to us whether it fulfill your requirement or need further assistance on this. 
 
Regards, 
Thaneegairaj S 


Marked as answer

VS Vivek Singhal replied to Thaneegairaj Sankar January 27, 2022 05:39 AM UTC

Thanks Sankar,

It's working as desired.


Thanks and Regards,

Vivek Singhal



TS Thaneegairaj Sankar Syncfusion Team January 28, 2022 09:24 AM UTC

Hi Vivek,  
 
We are happy to hear that your requirement has been achieved. Please feel free to contact us if you need any further assistance on this. 
 
Regards, 
Thaneegairaj S 


Loader.
Up arrow icon