我想知道这是否是范围问题。问题是我在xtype combo
(extjs3.4)中选择了一个选项,并且首先可以在if
部分(附加图像)的外部和内部读取该选项。现在,当我选择另一个选项时,该选择仅在if
部分之外读取(即,它不在其中读取)。这是范围的正常问题吗?如果是的话,我怎么解决呢?
listeners: {
'select': function(combo, record) {
var comboLayer = this.getValue();
var rawLayer = this.getRawValue();
var loadedLayers = [];
for(var i = 0; i < mapPanel.map.layers.length; i++) {
loadedLayers.push(mapPanel.map.layers[i].name);
}
console.log('outsideIf: ' + loadedLayers);
console.log('outsideIf: ' + rawLayer);
console.log('outsideIf: ' + comboLayer);
if (loadedLayers.indexOf(rawLayer) > -1) {
console.log('insideIf: ' + loadedLayers);
console.log('insideIf: ' + rawLayer);
console.log('insideIf: ' + comboLayer);
newUrl = '/pg?layers=' + comboLayer;
protocol.options.url = newUrl;
}
}
}