(首先是Overstack Post所以请提前原谅我发现任何错误。)
我正在使用SharePoint 2010.我创建了一个wiki页面,其中包含一个google地图,该地图显示了wiki页面上的sharepoint列表中的多个标记位置。该列表有两列(多行文本),其中包含地址和有关该位置的其他信息。谷歌地图API V3,从列表中获取每个地址,在该位置放置标记,并在标记信息中显示有关该位置的信息。
我的问题是信息列中的行返回不会出现在地图上的infowindow中。 infowindow将信息显示为信息窗口中的单行文本。如何从infowindow中的SharePoint列表信息列保留格式化(最关心行返回)?
<!--initialize is a function that needs to run when the page is loaded-->
<body onload="initialize()">
<form id="form1" runat="server">
<asp:ScriptManager runat="server" id="ScriptManager"></asp:ScriptManager>
<!--js?key is developer's API Key that can be gotten for free at https://code.google.com/apis/console/.-->
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=MYAPIKEY&sensor=false"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<!--width and height can be px or %-->
<div id="map_canvas" style="width: 700px; height: 500px"></div>
<script type="text/javascript">
// set up the basic map object
var latlng = new google.maps.LatLng(21.4667, 152);
var myOptions = {
zoom: 2,
center: latlng,
mapTypeId: google.maps.MapTypeId.SATELLITE
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
// this is used for geocoding
var geocoder = new google.maps.Geocoder();
function codeAddress(address, info) {
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
//this is needed for the marker's pop-up window, known as an infowindow.
var infowindow = new google.maps.InfoWindow({
content: info,
maxWidth: 60 });
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
// this is called with body's onload to pull addresses after the page is done loading.
function initialize() {
$("tr.ms-itmhover").each(function(i){
codeAddress($(this).find('.ms-rtestate-field:eq(0)').text(), $(this).find('.ms-rtestate-field:eq(1)').text());
});
}
</script>
SharePoint List Example:
Address: Information:
Jackson MI 5 Personnel Vacation
10 Personnel Office 1
11 Personnel Office 2
Vancouver BC Canada 2 Personnel Vacation
20 Personnel Office 1
12 Personnel Office 2
5 Personnel Office 3
Infowindow Example:
Marker shows on Jackson MI Infowindow shows: 5 Personnel Vacation 10 Personnel Office 1 11 Personnel Office 2
当然,所有标记信息都会这样做。任何帮助将不胜感激!
我有搜索Overstack的相关帖子,但没有看到任何。在网络上,我没有发现从SharePoint列表中使用格式化格式化infowindow的情况。我已经看到了如何使用CSS格式化infowindow,而不是如何从SharePoint列表中保留行返回。