-2
私はGoogleマップにマーカーを追加するために使用できる値の配列を作成しようとしていますが、このエラーは引き続き発生します。以下のコードでは、どこに間違っているかについての提案があります(かなり新しい...)。未定義のプロパティ1を設定できません - javascript/google maps api
おかげ ポール
var result2 = sforce.connection.queryAll("select Name,Lat__c,Long__c, Status__c from Site__c where Lat__c != null");
var records = result2.getArray('records');
var store_locations = new Array();
var Approved_store_locations = new Array();
var Rejected_store_locations = new Array();
var a=0,b=0,c=0;
for (var j=0; j< records.length; j++)
{
var record = records[j];
if (record.Status__c == "IB Approved")
{
Approved_store_locations[a][1] = [[new google.maps.LatLng(record.Lat__c, record.Long__c)],[record.Name]];
alert(Approved_store_locations[a][1]);
a++
} else if (record.Status__c == "Site Dead")
{
Rejected_store_locations[b][1] = [[new google.maps.LatLng(record.Lat__c, record.Long__c)],[record.Name]];
b++
} else
{
store_locations[c][1] = [[new google.maps.LatLng(record.Lat__c, record.Long__c)],[record.Name]];
c++
}
}
map = new google.maps.Map(document.getElementById("map"), myOptions);
for (i=0; i < store_locations.length; i++)
{
marker2 = new google.maps.Marker(
{
position: store_locations[i][0],
title: store_locations[0][i],
map: map
});
iconfile = 'http://maps.google.com/mapfiles/ms/icons/yellow-dot.png';
marker2.setIcon(iconfile);
}
for (i=0; i < Approved_store_locations.length; i++)
{
marker3 = new google.maps.Marker(
{
position: Approved_store_locations[i][0],
title: store_locations[0][i],
map: map
});
iconfile = 'http://maps.google.com/mapfiles/ms/icons/green-dot.png';
marker3.setIcon(iconfile);
}
for (i=0; i < Rejected_store_locations.length; i++)
{
marker = new google.maps.Marker(
{
position: Rejected_store_locations[i][0],
title: store_locations[0][i],
map: map
});
iconfile = 'http://maps.google.com/mapfiles/ms/icons/red-dot.png';
marker3.setIcon(iconfile);
}
を?より多くの情報を提供してください。また、この行の最後のループ – slawekwin
にあるscope3のオブジェクトを見ることができます:store_locations [c] [1] = [[google.maps.LatLng(record.Lat__c、record.Long__c)]、[record.Name] ]; – user1254490