primeng icon indicating copy to clipboard operation
primeng copied to clipboard

p-gmap in hidden containers fails

Open saienkin opened this issue 9 years ago • 10 comments

In one of my tabs I have to show a gmap component. but whatever I have tried hasn't worked. Here is my snippet:

<p-tabView>
        <p-tabPanel header="div1"  [selected]="true">
            <div></div>
        </p-tabPanel>
        <p-tabPanel header="gmap">
            <p-gmap.....
        </p-tabPanel>
        <p-tabPanel header="div3">
            <div></div>
        </p-tabPanel>
    </p-tabView>

How to overcome the problem? Thanks in advance.

saienkin avatar Jan 13 '17 07:01 saienkin

What messages, if any do you get in the console?

garethlewis avatar Jan 16 '17 09:01 garethlewis

to mr garethlewis there is no message in the console.

saienkin avatar Jan 19 '17 01:01 saienkin

This issue might be because of hidden container issue.I can see this issue with customized steps wizard as well.

image

sudheerj avatar May 07 '17 14:05 sudheerj

@Mrtcndkn take over please.

cagataycivici avatar Jun 19 '17 12:06 cagataycivici

@Mrtcndkn Is it planned for 4.1 release or is it may get delayed

sudheerj avatar Jun 21 '17 06:06 sudheerj

@sudheerj It is planned for 4.1 release.

Mrtcndkn avatar Jun 21 '17 06:06 Mrtcndkn

I also have a similar problem where the map remains blank when I open the tab. It is not the 1st tabViw tab. The solution I found is as follows:

private onTabChange(event: any): void {
    if ((event.index as number) === 1) {
        setTimeout(() => { window.dispatchEvent(new Event("resize")); }, 1);
    }
}

This was referred from this SO question: https://stackoverflow.com/a/6879644

Any way this fix can be incorporate in p-gmap? Or has it been incorporated in this commit itself?

smitpsanghavi avatar Jun 22 '17 07:06 smitpsanghavi

Thanks for the information we fixed it with an inside method.

Mrtcndkn avatar Jun 22 '17 07:06 Mrtcndkn

I saw in the commit details that the map has been initialized again. The answer I linked to has a comment where the map centre has been extracted, map "resized" and centre set once again. I hope this is not needed after @Mrtcndkn fix.

smitpsanghavi avatar Jun 22 '17 07:06 smitpsanghavi

In this method, map is initialized only when it gets visible so fixing the problem.

cagataycivici avatar Jun 22 '17 08:06 cagataycivici