In my web application, I have the standard scale bar on the left hand side of the screen. The 4 pan buttons work, the world button works, and the zoom in and zoom out buttons work. However, when using the mouse to slide the scale bar up and down, the map snaps back to the original view. I do have the map in an update panel, and I have the following trigger: <asp:AsyncPostBackTrigger ControlID=“Map1” EventName=“Click” /> for that update panel. (It’s what allows my pop-ups to show). When I remove this trigger, the map scale bar then works correctly; however, I need this trigger to update my map when the user is interacting with it. Do you have any thoughts on how to fix this?
Thank you, Treasa
Scale Bar Not Working
Hi Treasa,
We cannot know what’s the issue only from your description, please build a simple project contains your scale bar which can reproduce your issue and upload here, we will help you find the problem.
Please remove all unnecessary code in it.
Regards,
Don
Hi,
I’m attaching a sample project that demonstrates the issue. I started with your Vehicle Tracking template, and stripped it down so that it just shows the map and the issue I am having when sliding the scale bar.
Thank you, Treasa
Vehicle_Tracking.zip (418 KB)
Hi Treasa,
Yes I reproduced that local, but I am sorry I haven’t found what cause this issue.
When test I found if you pan map by mouse, the slider works again. Then I create a new project use the same code, and the slider works well. So I think that’s not a issue in map, but is a special situation for the project.
So I think you should want to create a new project and copy the background code to there instead of delete from our sample.
Regards,
Don
Hi Don,
I was able to reproduce this effect on two separate projects - my primary project and the one that I attached previously to this ticket. I am unable to create a blank project with the Map showing successfully. Can you attach the project where is works for you, so I can use this as a starting point?
Thanks, Treasa
Hi Treasa,
I directly modify a sample from our HowDoISamples, and it looks work well.
Please see attached files and I think you can also build your project based on our HowDoISamples.
Regards,
Don
12628.zip (2.11 KB)
Hi Don,
While the sample does works, it does not have any of the original requirements in my original post. My map has to be in an update panel since it is one component of the web page, and I need a trigger to refresh the map when the user clicks on it.
In other words, the .aspx page has to have:
<asp:UpdatePanel ID="UpdatePanel2" style="width: 100%; height: 100%;" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<cc1:Map ID="Map1" runat="server" Height="100%" Width="100%" Visible="true"></cc1:Map>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Map1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
This appears to be a limitation or bug in the adornment layer when it is part of the map in an update panel with a trigger for the map. I would like to know if it is a limitation if there is any workaround. If it is a bug, can we get it scheduled to be fixed?
I appreciate any help you can provide in this case. Thank you,
Treasa
Hi Treasa,
Please remove Triggers tag, everything will works well.
Regards,
Don
Hi Don,
If you read my original post, I already stated that if you remove the triggers tag, I know that everything works well for the adornment layer; however, then I cannot get the popups to display in the map.
I need both the adornment layer to work, and popups to display in the update panel as well.
Please advise. If this is a bug, can we get it scheduled to be fixed?
Thanks,
Treasa
Hi Treasa,
I researched that today, and found the reason is it looks the event bubbling haven’t been stopped succeed when you release your mouse after drag the slider.
When you moved slider, the event handled by panzoombar, but after that, it also sent the event to map and fire the click event, because map is inside update panel, so it refresh the map and get original panzoombar status before you drag slider.
I read the code of OpenLayers, it looks the event bubbling is stopping by all functions include zoomBarDown, zoomBarDrag, zoomBarUp and divClick. I am not sure whether it’s a bug but it’s not easy to be solved.
For a workaround, I think we can try to use OnClientClick instead of OnClick, which will fire a javascript function to get json information from server side, then create the popup and add it on map by JavaScript. If you think that can works for your scenario, I can provide more help on it.
Regards,
Don
Hi Don,
Thank you for doing the in-depth research! I would like to request this feature be fixed in an upcoming version of Map Suite Web. Do you know who I need to contact to make this happen?
In the meantime, I would like to try the workaround. I am just not sure if the OnClientClick will work for me. In my application, the Map1_Click function queries a database and gets information to create a chart that is displayed in the popup. Do you have a quick template I could use to try this workaround?
Thank you!
Treasa
Hi Treasa,
Thanks for your feedback, we will fix it in the upcoming release 9.0, as we have stopped the daily builds for the upcoming release, I guess you may need to wait until 9.0 is released. If it’s urgent for you, please let us know.
Thanks,
Johnny
Hi Johnny,
Thanks for the update. If 9.0 is still scheduled to come out this summer, I can wait.
Treasa
Hi Treasa,
Thanks for you waiting.
Any question please let us know.
Regards,
Don
Hi Don/Johnny,
We just upgraded to 9.0, and the scale bar is working as it should. Thank you for all your help in this matter.
Treasa
Hi Treasa,
I am glad to hear that works for you.
Regards,
Don