ghiscoding / slickgrid-universal

Slickgrid-Universal is a monorepo which includes all Editors, Filters, Extensions, Services related to SlickGrid usage and is also Framework Agnostic
https://ghiscoding.github.io/slickgrid-universal/
MIT License
88 stars 27 forks source link

AutoResize option with "resizeDetecion : 'container'" invoke the "[ResizeObserver is not a constructor]" exception. #1480

Closed good-ghost closed 5 months ago

good-ghost commented 5 months ago

Describe the bug

In the Salesforce LWC,

AutoResize option with "resizeDetecion : 'container'" invoke the "[ResizeObserver is not a constructor]" exception.

Reproduction

Create the LWC component from Salesforce platform.

Here is code I used.

        const container = this.template.querySelector(".user-grid");

        let gridOptions = {
            enableAutoResize: true,
            autoResize: {
                container: container,
                resizeDetection: 'container',  // the 2 options would be 'container' | 'window'
                // calculateAvailableSizeBy: 'container',
            },
            ...
        ];

Above code create the exception with message "[ResizeObserver is not a constructor]".

How can I handle this? Anyone had sole this problem?

Which Framework are you using?

Other

Environment Info

| Executable          | Version |
| ------------------- | ------- |
| Salesforce LWC      | 60.0    |
| Slickgrid-Universal | 4.6.1   |
| TypeScript          | -       |
| Browser(s)          | Chrome 124 |
| System OS           | Windows 10 |

Validations

ghiscoding commented 5 months ago

That code is part of the Example 14 demo and it works fine, it must be another one of those "Doesn't work in Salesforce" problem and if that is the case then there's nothing I can do.

https://github.com/ghiscoding/slickgrid-universal/blob/094d7602d7170b2f395985ce5635041bb2b803d2/examples/vite-demo-vanilla-bundle/src/examples/example14.ts#L411-L415

The resize detection container uses the ResizeObserver and I assume it's blocked, like many other things, in Salesforce. That code was added but someone else and I don't entirely know how it works but I would suggest you use the regular resizer

good-ghost commented 5 months ago

OK, Thanks,

I will try with regular resizer.