[OpenLayers-Users] How to extract attributes on layer load ?
Volodymer Grigorenko
wolgri at ya.ru
Mon Jul 14 15:06:27 EDT 2008
On 14:14 Thu 19 Jun , Ken-ichi wrote:
> Hi,
> Have you tried listening for the loadend or featuresadded events? I
> haven't worked with WFS layers yet, so I don't know if this would
> work, but you could try
> yourWFSLayer.events.on({
> 'loadend': function() {
> alert('foo');
> }
> });
> map.addLayer(yourWFSLayer);
> -ken-ichi
Thanks this works but the next question.
How get map.layers[this digit] in function
or how to give it as variable to function
Му function
function func1(mnum){
alert(mnum); //works
html = ""
features = map.layers[mnum].features; //not works returns map.layers[mnum] undefind
if (features.length == 0){html = ""}
else {
html += "<p>Mid</p><div class=\"info\"><fieldset>";
for (var f = 0; f < features.length; f++) {
html +="<input value=\""+features[f]+"\" type=\"checkbox\">" +features[f].attributes["datsetid"]+"</br>";
}
html += "</fieldset></div>"
}
document.getElementById('select_wfsQ').innerHTML = html;
}
wfs_e.events.on({ 'loadend': func1(3) }); // if just func1 and define mnun inside function all ok
More information about the Users
mailing list