简体   繁体   English

如何在JSF中模糊事件后刷新组件

[英]How to refresh component after blur event in JSF

I'm using gmaps4jsf to show Google Maps in my application, but I would like to update the map after user type his/her stret, city, state and country. 我正在使用gmaps4jsf在我的应用程序中显示谷歌地图,但我想在用户输入他/她的拉伸,城市,州和国家后更新地图。 This way I could give more accurate information to gmaps4jsf dynamically. 这样我就可以动态地向gmaps4jsf提供更准确的信息。

But everytime I fill some of the fields, the maps it's gone. 但每当我填写一些字段时,地图就会消失。 I'm doing this for instance with state : 我正在这样做,例如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>

How can I show the map dynamically as user type his/her address? 当用户输入他/她的地址时,如何动态显示地图?

Yes, in order to change the map content dynamically using Ajax, you need to set partiallyTriggered attribute to true. 是的,为了使用Ajax动态更改地图内容,您需要将partiallyTriggered属性设置为true。

Check the JSF Mashup remix demo that uses GMaps4JSF 3.0.0 for seeing how you can update the map content using Ajax: 查看使用GMaps4JSF 3.0.0的JSF Mashup remix演示,了解如何使用Ajax更新地图内容:
http://www.mashups4jsf.com/gmaps4jsf-examples2-3.0.0/pages/theater2.xhtml http://www.mashups4jsf.com/gmaps4jsf-examples2-3.0.0/pages/theater2.xhtml

This is also the demo source code: 这也是演示源代码:
http://www.mashups4jsf.com/gmaps4jsf-examples2-3.0.0/pages/theater2.xhtml.source http://www.mashups4jsf.com/gmaps4jsf-examples2-3.0.0/pages/theater2.xhtml.source

Try to set the following attribute: partiallyTriggered="true" . 尝试设置以下属性: partiallyTriggered="true" This will allow partial rendering, sepcially if you are using ajaxfied data submittion. 这将允许部分渲染,特别是如果您使用ajaxfied数据提交。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM