- Home
- Forum
- Angular - EJ 2
- Can I trigger a specific event manually?
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
- 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.
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.
https://www.syncfusion.com/account/login
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?
Hi RolJan,
Thanks for contacting Syncfusion support.
Kindly share the below details to proceed further with your query.
- Share the complete Grid code files and package.json file.
- Share the video demo of the reported problem.
- Are you facing the styling issue in the Grid layout? Have you used any custom CSS in the Grid?
- 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
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)
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.
- 7 Replies
- 5 Participants
- Marked answer
-
JC Jonas Czeslik
- Aug 31, 2021 09:25 AM UTC
- Dec 13, 2022 08:38 AM UTC