function addDoctorLocation(options)
{
var gm = Ext.getCmp('mygooglemap');
var mpoint = new google.maps.LatLng(options.lat,options.lng);
var marker = gm.addMarker(mpoint,options.marker,false,false, options.listeners);
infoBubble = new InfoBubble({maxWidth: 300});
}
tree.on('checkchange', function(node){
var data = node.data;
if (data.checked == true){
var options = {
lat:3.951941,
lng:102.052002,
marker: {title:"Hello World!"},
listeners: {
click: function(e){
}
}
}
addDoctorLocation(options);
}
Ext.MessageBox.show({
title: 'Changed checkbox status',
msg: 'MainID: ' + data.MainID + ' <br /> Checkbox status: ' + data.checked,
icon: Ext.MessageBox.INFO
});
})
问题
此代码在选中复选框时成功添加标记,但是,当未选中复选框时如何删除标记?
我需要为标记分配一个ID吗?取消选中时,我应该删除 id 的标记吗?附加:一张地图有多个标记,而不仅仅是1个标记