Drupal 7 Can';t从映射中删除标记(无法读取属性';取消选择所有';)
我正在尝试从地图中删除标记,但无法删除。我可以选择它,移动它,但当我试图删除它没有做任何事情 单击删除选项时,会弹出以下js错误:Drupal 7 Can';t从映射中删除标记(无法读取属性';取消选择所有';),drupal-7,openlayers-3,Drupal 7,Openlayers 3,我正在尝试从地图中删除标记,但无法删除。我可以选择它,移动它,但当我试图删除它没有做任何事情 单击删除选项时,会弹出以下js错误: Uncaught TypeError: Cannot read property 'unselectAll' of undefined openlayers_behavior_geofield.js?n5kot1:39 controls.push.OpenLayers.Control.ModifyFeature.handleKeypress openlayers_b
Uncaught TypeError: Cannot read property 'unselectAll' of undefined openlayers_behavior_geofield.js?n5kot1:39
controls.push.OpenLayers.Control.ModifyFeature.handleKeypress openlayers_behavior_geofield.js?n5kot1:39
OpenLayers.Handler.OpenLayers.Class.callback OpenLayers.js?n5kot1:205
OpenLayers.Handler.Keyboard.OpenLayers.Class.handleKeyEvent OpenLayers.js?n5kot1:647
(anonymous function) OpenLayers.js?n5kot1:63
有人知道为什么会这样吗
我使用的是Openlayers 7.x-2.0-beta9和Geofield 7.x-2.1
谢谢
失败的Geofield文件(openlayers\u behavior\u Geofield.js):
你能发布你正在使用删除标记的代码吗?另外,创建一个JSFIDLE或包含一个指向网站的链接来演示这个问题也会有帮助。我没有对原始代码做任何修改。我已经用代码更新了问题!有问题的网页还没有上线。。。但我要做的是用地图创建Drupal内容,并在地图上绘制位置。在编辑Drupal内容以删除地图中的位置时,我无法删除标记。
if (options.allow_edit && options.allow_edit !== 0) {
// add an Edit feature
controls.push(new OpenLayers.Control.ModifyFeature(layer, {
deleteCodes: [46, 68, 100],
handleKeypress: function(evt) {
if (this.feature && OpenLayers.Util.indexOf(this.deleteCodes, evt.keyCode) > -1) {
// We must unselect the feature before we delete it
var feature_to_delete = this.feature;
this.selectControl.unselectAll();
this.layer.removeFeatures([feature_to_delete]);
}
}
}));
}