我正在使用gmaps4jsf在我的应用程序中显示谷歌地图,但我希望在用户输入他/她的街道、城市、州和国家后更新地图。这样,我可以动态地向gmaps4jsf提供更准确的信息。
但每次我填满一些字段,地图就消失了。例如,我正在使用state执行此操作
State:<h:message id="m_state" for="state" styleClass="red" /><br/>
<h:selectOneMenu id="state" value="#{propertyC.property.addressState.state}">
<f:selectItem itemLabel="" itemValue="" />
<f:selectItems value="#{addressB.states('US')}" var="state" itemValue="#{state.key}" itemLabel="#{state.value}" />
<f:ajax event="blur" render="m_state map" />
</h:selectOneMenu>
<br/>
// others fields
<m:map id="map" width="425px" height="250px" address="#{propertyC.property.street}, #{propertyC.property.addressCity.city}, #{propertyC.property.addressState.state}, #{propertyC.property.addressCountry.country}, #{propertyC.property.cep}" zoom="25" autoReshape="true" >
<m:marker>
<m:icon imageURL="http://i.imgur.com/WFJo62Q.png"/>
</m:marker>
</m:map>如何在用户键入其地址时动态显示地图?
发布于 2013-05-05 23:39:11
是的,为了使用Ajax动态更改地图内容,您需要将partiallyTriggered属性设置为true。
查看使用GMaps4JSF 3.0.0的JSF Mashup remix演示,了解如何使用Ajax更新地图内容:
http://www.mashups4jsf.com/gmaps4jsf-examples2-3.0.0/pages/theater2.xhtml
这也是demo的源代码:
http://www.mashups4jsf.com/gmaps4jsf-examples2-3.0.0/pages/theater2.xhtml.source
发布于 2013-05-05 02:58:19
尝试设置以下属性:partiallyTriggered="true"。这将允许部分呈现,特别是当您使用ajaxfied数据提交时。
https://stackoverflow.com/questions/16277357
复制相似问题