Can I trigger a specific event manually?

Hello Syncfusion team, 

I was wondering, if I can trigger events manually (without actually doing the triggering action). 
In Javascript e.g. there is a possibility to say window.dispatchEvent(new Event("resize")); and the window resize event is triggered without actually resizing the window.

In my case, it would be helpful to trigger a column resize event in my grids because the column widths are not loaded correctly, so there are discrepancies between the header and the data rows (example below). If I resize one of the columns, all the columns directly adapt their actual width, so I would like to trigger that everytime the grid has loaded itself.

Thanks in regard,

Jonas Czeslik





7 Replies 1 reply marked as answer

MS Manivel Sellamuthu Syncfusion Team September 1, 2021 09:23 AM UTC

Hi Jonas, 

Greetings from Syncfusion support. 

Based on your query you are having header misalignment in the grid and it is resolved while resizing the column. We have prepared a simple sample based on the shared screenshot. But we did not faced the mentioned issue. It is working fine at our end. Please find the below sample for your reference. 


Please share us the following information to validate further on this, 

  • Share us the entire Grid code file
  • Share the Syncfusion packages version
  • Have you used any custom CSS for  the grid, if so please share them
  • If possible share us a simple sample to replicate the problem or try reproducing it in the above provided sample.

Regards, 
Manivel 



JC Jonas Czeslik September 1, 2021 09:43 AM UTC

I guess, it is not possible to share a simple sample of that problem because I cannot replicate it in an "only-syncfusion-sphere" . So my guess is that it has to do with some other features like a golden layout container and its offsets, width and height observers, custom stylings or something like that, but that would carry things too far. 

It would have been an easy solution to say something like this.gridObj.triggerResizeEvent(), but if thats not possible, I have to search for the error in the mentioned areas individually.

Thanks for the help!
Jonas C. 



RS Rajapandiyan Settu Syncfusion Team September 2, 2021 11:36 AM UTC

Hi Jonas 
  
Thanks for your update. 
 
We have created a new incident under your Direct trac account to follow up with this query. We suggest you follow up with the incident for further updates. Please log in using the below link.

https://www.syncfusion.com/account/login  
  
Regards,  
Rajapandiyan S  



RO RolJan December 9, 2022 08:49 AM UTC

Hello,


I am facing the same problem with offset (and also would like to have this trigger on column resize).

By any chance, is there a solution found by You, Jonas?




RS Rajapandiyan Settu Syncfusion Team December 12, 2022 09:50 AM UTC

Hi RolJan


Thanks for contacting Syncfusion support.


Kindly share the below details to proceed further with your query.


  1. Share the complete Grid code files and package.json file.
  2. Share the video demo of the reported problem.
  3. Are you facing the styling issue in the Grid layout? Have you used any custom CSS in the Grid?
  4. If possible, share the reproducible sample, which will be very helpful in resolving earlier. (https://ej2.syncfusion.com/angular/demos/#/material/grid/default)


Regards, 

Rajapandiyan S



RO RolJan December 12, 2022 09:58 AM UTC

Dear Rajapandiyan,


I've found a solution for column misalignment - it was caused by default padding-right of e-gridheader.
Changed it to
0 !importntant

Was enough to solve the problem.


For resizing problem: solution was to use:
resizeSettings = { mode: 'Auto' };  

For grid configuration (always resize to the max width)


Marked as answer

PS Pavithra Subramaniyam Syncfusion Team December 13, 2022 08:38 AM UTC

Hi RolJan,


We are happy to hear that you have found the solution to your issue.


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


Loader.
Up arrow icon