简体   繁体   English

在Primefaces gmap中关闭信息窗口

[英]Closing an infowindow in Primefaces gmap

I am using primefaces googlemap with markers and infowindow. 我正在使用带有标记和信息窗口的primefaces googlemap。 The infowindow has a button on it. 信息窗口上有一个按钮。 On the click of the button, I am invoking a method in the backing bean for processing. 单击按钮后,我正在调用后备bean中的方法进行处理。 At the same time, I want to close the info window. 同时,我想关闭信息窗口。 I am using the close() method of infowindow, but that is refreshing my map. 我正在使用infowindow的close()方法,但这正在刷新我的地图。 My backing bean is a ViewScoped bean and hence the refresh is not working well for me. 我的后备bean是ViewScoped bean,因此刷新对我而言效果不佳。 Is there any better way to close an infowindow without refreshing the page? 有什么更好的方法可以在不刷新页面的情况下关闭信息窗口? This is how my xhtml looks like. 这就是我的xhtml的样子。

<p:gmap center="21, 78" id="map" zoom="2" type="roadmap" style=" margin: 0 auto 0 auto;height: 500px"  model="#{sBean.mapModel}" widgetVar="mapVar">
    <p:ajax event="overlaySelect" listener="#{sBean.onMarkerSelect}" update="messages"/> 
        <p:gmapInfoWindow id="infoWindow" rendered="#{sBean.showInfoWindow}"> 
              ...........................................................


              <p:commandButton id="connect" value="Connect" actionListener="#{sBean.connect()}" onclick="infoWindow.close();"/> 
        </p:gmapInfoWindow>                              
</p:gmap>

// get map instance var map = PF('pfMapWidget').getMap(); //获取地图实例var map = PF('pfMapWidget')。getMap();

// close the opening info window map.infoWindow.close(); //关闭打开的信息窗口map.infoWindow.close();

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

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