I have a Grid in that grid i bind all my loactions.when i click on any row of grid i need to show a cloud popup with that grid row deatils using java script.how to show cloud popup using java script.
How to show cloud popup using java script
Hi Raj,
Here are two ways you can try,
1. Create a new cloudPopup when you click on any row in grid,
function showPopup(){
var popup = new OpenLayers.Popup.FramedCloud("popupid",
new OpenLayers.LonLat(5,78),
new OpenLayers.Size(200,200),
"example popup",
null,
true);
Map1.GetMapParser().map.addPopup(popup);
2. Init all the popups at server side, and show them at client side when you click any row to fire them,
Server side:
CloudPopup popup = new CloudPopup(feature.Id, new PointShape(6, 70), "popup1");
popup.IsVisible = false;
Map1.Popups.Add(popup);
Client side:
function showPopup(id){
var popups = Map1.GetMapParser().map.popups;
for (var i = 0; i < popups.length; i++) {
if(popups<i>.id == id){
popups<i>.show();
}
}
Just let you know the second way is common and recommanded, the advantage is we can keep the synchronization between the client and server side,
Hope it helps,
Edgar
Hi There:
We have code to use a Cloud Popup and it works fine in ThinkGeo MVC Version 7.0 but when we upgrade to Version 9 and the following line of code stop working:
var infoPopup = Map1.popups[0]; // pre-created popup window
infoPopup.lonlat = e.worldXY;
Here is the error message: "Uncaught TypeError: Cannot set property ‘lonlat’ of undefined"
How to get the lat and lon for the Cloud popup in Version 9.
Thanks,
Adrian
Hi Adrian,
Please see my reply in your other post:
thinkgeo.com/forums/MapSuite/tabid/143/aft/11087/Default.aspx
Regards,
Don