示例:
http://jsfiddle.net/7Cwbn/60/
我试图使用来自PHPJS的函数来检查selectedFeatures中的所有元素是否都在elem.features中,但我接收的是undefined。怎么回事?
$(markers.houses).each(function(index, elem) {
//first filter by selected features
console.log(array_diff(elem.features, selectedFeatures).length);
if (array_diff(selectedFeatures, elem.features).length == 0) {
if (!markers.houseMarkers[index].visible) {
markers.houseMarkers[index].setVisible(true);
}
}
});发布于 2012-06-15 19:31:46
解决方案:
在array_diff()定义中,将retVal更改为相等的[],而不是{}。
https://stackoverflow.com/questions/11056058
复制相似问题