0

In my code, I have a button that displays information in my gridpanel and it add a vectorlayer in it. I want to add zoom on those polygon, but I did not succeed

My code:

testlayer.events.register( testlayer, function(){ 
map.zoomToExtent(testlayer.getDataExtent())
});

Note this code functions when I add the vectorlayer only, but when I add the action of displays information in my gridpanel it is not working.

any help is apprecited

1

What about replacing

testlayer.events.register(testlayer, function () {
            map.zoomToExtent(testlayer.getDataExtent())
         });

with

testlayer.events.register('loadend', testlayer, function (evt) {
            map.zoomToExtent(testlayer.getDataExtent())
        });
  • thanks for your answer ; i think the problem is not from the function because wehen the action is just display the vector layer it works but when the action is display the vector layer on map and display information in grid pannel ,the funtion don't work have you any solution for that and thank you again M.Farhat Abbas – rimuser Oct 30 '13 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.