Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collapsed b:panel p:gmap #720

Closed
chongma opened this issue Apr 22, 2017 · 13 comments
Closed

collapsed b:panel p:gmap #720

chongma opened this issue Apr 22, 2017 · 13 comments
Assignees
Labels
Milestone

Comments

@chongma
Copy link
Collaborator

chongma commented Apr 22, 2017

if a b:panel is collapsed on page load then a p:gmap inside does not get rendered.

@stephanrauh
Copy link
Collaborator

Sounds like the same bug as #205. Can you give us a reproducer?

@chongma
Copy link
Collaborator Author

chongma commented Apr 22, 2017

ok i pushed to my test project https://github.com/chongma/test. choose test-> gmap

@stephanrauh
Copy link
Collaborator

I have some difficulties to get the project up and running. Which application server do you use?

@chongma
Copy link
Collaborator Author

chongma commented Apr 23, 2017

I used TomEE 7.0.2 but added the same dependencies as there​ were on the BootsFacesWeb project to try to make it compatible

@stephanrauh
Copy link
Collaborator

OK, I've got a TomEE 7.0.2 on my PC, so I just have to re-import it into Eclipse.

I don't understand why your project doesn't work with my Wildfly. Probably because I used the wrong URL, but still, it shouldn't be that difficult to find out the URL, should it?

@chongma
Copy link
Collaborator Author

chongma commented Apr 23, 2017

I had never heard of wildfly before now. Which URL was wrong? Did the server start ok? Maybe it is the faces version or web deployment descriptor because they are the only bits i added

@stephanrauh
Copy link
Collaborator

Wildfly is the open source version of JBoss. It's one of the leading JavaEE application servers. But if you ask me, it's also an application server that adds a lot of complexity to your program. At least from a developers perspective. From the operations point of view, that's probably a lot of necessary features.

Be that as it may, I've managed to find out the real URL, and I think I can confirm your bug. I don't have a valid Google maps API key, but even so, I think the page shouldn't look like so:
image

I guess the lower panel should also show the error message.

@chongma
Copy link
Collaborator Author

chongma commented Apr 24, 2017

Ah well i have heard of JBoss of course. Yes that is exactly how the test looks on my system too. Let me know if you need me to do anything else

@stephanrauh
Copy link
Collaborator

As it turns out, this doesn't work with the PrimeFaces p:panel, either. PrimeFaces implements code ensuring that that code works, but for some reason, it doesn't.

My best effort so far is this:

<b:panel rendered="#{gmapBean.mapModel ne null}" title="Map"
     collapsed="true" 
     onexpanded="PrimeFaces.widgets.hiddenMap._render();">
      <p:gmap center="#{gmapBean.latLng.lat},#{gmapBean.latLng.lng}"
           zoom="15" type="HYBRID" style="width:250px;height:250px;"
           model="#{gmapBean.mapModel}" widgetVar="hiddenMap"/>
</b:panel>

The Gmap widget is given a widgetVar, and the internal _render() method is called after expanding the panel.

Problem: the map doesn't show. On the plus side, there's the error message indicating the I don't have the API key, so it seems to be the right direction.

In theory, there's another, better approach: wrap the Gmap widget in a div like so:

<div class="ui-hidden-container" id="gmapwrapperId">
    <p:gmap ... />
</div>

The problem with the second approach is that it does even less. The widget is initialized on the PrimeFaces side, but there's not even an error message.

@stephanrauh
Copy link
Collaborator

@tandraschko: does this pique your curiosity? It seems the deferred initialization of <p:gmap> doesn't work if the widget is in an inactive tab or a collapsed panel. It's not surprising it doesn't work with BootsFaces, but IMHO this pure-PrimeFaces code shou'd work, shouldn't it?

<p:panel rendered="#{gmapBean.mapModel ne null}" title="Map" header="Map"
	collapsed="true" toggleable="true">
		<p:gmap center="#{gmapBean.latLng.lat},#{gmapBean.latLng.lng}"
			zoom="15" type="HYBRID" style="width:100%;height:250px;"
			model="#{gmapBean.mapModel}" />
</p:panel>

Also see http://stackoverflow.com/questions/19067780/primefaces-gmap-not-rendered-when-style-display-none.

@tandraschko
Copy link

Yup, should actually work. Not sure if the problem is the panel or the gmap ;)

geopossachs added a commit to geopossachs/BootsFaces-OSP that referenced this issue May 15, 2019
@geopossachs
Copy link
Collaborator

geopossachs commented May 15, 2019

I write for the same error a solution by b:tabView #205
The solution will also work in the same way for b:panel :-)

@geopossachs
Copy link
Collaborator

i retest it, the bug was fixed with version 1.4.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants