Anita44 / gmaps4jsf

Automatically exported from code.google.com/p/gmaps4jsf
0 stars 0 forks source link

Map cannot be Ajax (re-)rendered #199

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. You have a map tag combined with a JSF ajax element triggering a render (may 
be a4j:commandButton, rich:autocomplete etc. - see code below with 
a4j:commandButton

2. You get the page displayed with the map - in my test case a static reference 
to an address, but of course the same issue appears with dynamic address coming 
from server

3. You activate the render (e.g. by pressing the command button or leaving the 
input control (onblur)

What is the expected output? What do you see instead?
I would expect that the map is rerendered and updated to the server status in 
case it is dynamically connected with server information.
What I see is that the map (even with static address) completely disappears, 
when the rerender is triggered, while other controls (e.g. outputText) behave 
as expected.

What version of the product are you using? On what operating system?
gmaps4jsf 3.0.1-SNAPSHOT
Richfaces 4.3.2.Final
Oracle Enterprise Linux 5 64 Bit

Please provide any additional information below.
Code showing the issue. If you press the button, the map disappears.

<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:m="http://code.google.com/p/gmaps4jsf/"
    template="/layout/gmapsTemplate.xhtml">

    <ui:define name="pagetitle">
        <h:outputText value="Address Geographic Mapping"
            styleClass="Captionsize" />
    </ui:define>

    <ui:define name="body">

        <h:form>

            <h:panelGrid columns="2">

                <h:panelGroup id="mapAddress">
                    <h:outputText value="show: #{addressBacking.addressString}" />
                    <m:map width="500px" height="500px" address="Wall 1">
                        <m:marker />
                        <m:htmlInformationWindow htmlText="Wall 1" />
                    </m:map>
                </h:panelGroup>

                <h:panelGroup>
                    <a4j:commandButton render="mapAddress" />
                </h:panelGroup>

            </h:panelGrid>

        </h:form>

    </ui:define>

</ui:composition>

Original issue reported on code.google.com by christop...@jki.bund.de on 1 Aug 2013 at 10:20

GoogleCodeExporter commented 9 years ago
Sorry, I have found the solution for this in 
http://stackoverflow.com/questions/16277357/how-to-refresh-component-after-blur-
event-in-jsf. It is necessary to explicit the option partiallyTriggered="true" 
for the map tag.
Nevertheless I would consider it preferable to have this as default 
configuration, to prevent developers from this trap.
Regards Chris

Original comment by christop...@jki.bund.de on 1 Aug 2013 at 12:57