pop up alignment issue

Hello Synfusion Team,

We are using synfusion grid. And we have defined a custom pop up for that named "Custom View" in toolbar of the grid. But the pop is not getting properly aligned to the icon. Is there any control with which we can achieve the requirement?



We have used mat-menu for this pop-up.


5 Replies 1 reply marked as answer

RS Rajapandiyan Settu Syncfusion Team November 2, 2021 01:50 PM UTC

Hi Ansuman, 

Thanks for contacting Syncfusion support. 

We have validated your requirement at our end. You need to customize the position of your popup before show it in the DOM. We have prepared a sample for your reference. You can get it from the below link. 


When you click the toolbar button, the toolbarClick event will be triggered. In that event, we have customized the position of popup element based on the target element position before show it in DOM. 



[app.component.ts] 

 
  clickHandler(argsClickEventArgs): void { 
    if (args.item.id === 'Click') { 
      var target = document.getElementById('Click').closest('.e-toolbar-item'); 
      // get the target element position details 
      var elempos = target.getBoundingClientRect(); 
      // customize the position of popup based on the target element position 
      this.dialog.element.style.left = elempos.x + 'px'; 
      this.dialog.element.style.top = elempos.height + elempos.y + 'px'; 
      // show the dialog 
      this.dialog.show(); 
    } 
  } 
 


Still if you face the issue, kindly share the below details to replicate it at our end. 

  1. Share the complete code files (app.component.html/app.component.ts).
  2. If possible share the issue reproducible sample or make the issue in given sample which will be very helpful for us.

Regards, 
Rajapandiyan S 



AP Ansuman Panda November 5, 2021 04:22 AM UTC

Thank you, Team. The solution worked 

However, I tried to replicate the same for the column chooser. But it's not opening at the same place of the toolbar.

    if (args.item.id === 'column-chooser') {
      var target = document.getElementById('column-chooser').closest('.e-toolbar-item');
      var elempos = target.getBoundingClientRect();
      var left = elempos.x;
      var top = elempos.height + elempos.y;
      this.grid.openColumnChooser(lefttop);
    }


i tried with  this.grid.openColumnChooser(topleft);  but the position still not the same. Is there any other way to do this.  




RS Rajapandiyan Settu Syncfusion Team November 8, 2021 05:13 AM UTC

Hi Ansuman, 

Thanks for your update. 

We have validated your requirement at our end. We suggest you to remove the elempos.y value from the top value to achieve your requirement. Find the below modified code example for your reference. 


[app.component.ts] 

 
  clickHandler(argsClickEventArgs): void { 
    --- 
    if (args.item.id === 'column-chooser') { 
      var target = document.getElementById('column-chooser').closest('.e-toolbar-item'); 
      var elempos = target.getBoundingClientRect(); 
      var left = elempos.x; 
      var top = elempos.height; // get the top value 
      this.grid.openColumnChooser(lefttop); 
    } 
  } 
 


Since the target of ColumnChooser popup is EJ2 Grid element. So, there is no need to use the elempos.y value in the top position. 


Also, we would like to let you know that the Grid have built-in support to open the column chooser from the toolbar. Find the below documentation for your reference. 


Please get back to us if you need further assistance with this. 

Regards, 
Rajapandiyan S 


Marked as answer

AP Ansuman Panda November 8, 2021 06:21 AM UTC

Thank you Rajapandiyan and Synfusion Team for helping.



RS Rajapandiyan Settu Syncfusion Team November 9, 2021 03:26 AM UTC

Hi Ansuman, 

We are glad that you have achieved your requirement with the provided solution. 
 
Please get back to us if you need further assistance. 
 
Regards, 
Rajapandiyan S 


Loader.
Up arrow icon