I have a grid with sub rows configuration.
The sub row contains of a simple div container: <div id="map-container"></div>
When a sub row is expanded for the first time a google maps is initialized inside the div container.
However when the row is collapsed or out of screen the content (in my case the google maps) inside the div container is removed.
This happens even if preserve option is set to true.
Having that in mind i have to initialize google maps every time and this is NO-GO because each initialization costs money due to google payment policy for using their google maps service.
How can i make sure that the content inside a sub row isn’t removed from the DOM upon collapsing or being out of screen?
It’s quite specific requirement, and there is no built-in config for that (as preserve saves state and context, but doesn’t save the html container.
Technically, you can store the Google Maps container outside the grid, and attach this container to the subrow on expand. The only bottleneck of this approach, is that you can keep only one subrow opened.
With half my respect but this is not specific requirement at all.
The same happens when we have a layout and attached map to a cell and then collapse the cell. The map gets removed from the DOM and when the layout cell is expanded the map and ALL its state (user drawing and so on) is not anymore there.
Instead of creating a “storage” container outside of dhx environment and handling all the complexity of attaching it back, the user should simply be able to specify the behavior of the API via a property - to remove the dom upon hiding element or to keep it there.
I sent a request to the dev team, and they will consider implementation of such option for future versions. There is no eta, but I will notify you on any updates.
Kind regards,
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan