I've been trying to cutomize the display of Address Bing Map Location in CRM form. Instead of displaying it by default, I want it to display on modal popup. So once the user clicked on the address, the modal popup should display with the Map on it. What do you guys think is the better approach should I used? Should I just enable the Showing of Bing Maps through system configuration then hide it by default once the page is loaded, then append it to the modal once the address is clicked or just make a function that will create a bing Map? Actually I'm working on the second choice but didn't able to make it right. Here's the code I have so far, been using this through console, yes it display the Map but really dont have an Idea what credentials should I put.
`$("#address1_composite").click(function(){
alert();
var map = null;
map = new Microsoft.Maps.Map(document.getElementById('SDKmap'), null)
})
Hope that my explanation is clear enough to understand the requirement.
`
I highly recommend that you load the map ahead of time, or delay until it is first needed, but then only hide/show it using your click events. Otherwise a user code end up loading the map multiple times in a single page view which would generate lot of transactions and make it very costly very fast.
Related
Something has crossed my mind recently and I can't seem to really find an answer .. I have tried few times and without success.
How do you get a google search box with places and locations without having the map on the same page.
You basically choose the place , then press search and it redirects to a map.
The part where I am stuck is that I just want the google search box from here , without the map ? Any ideas ?
https://developers.google.com/maps/documentation/javascript/examples/places-searchbox
Here is another example :
To resume : Is it possible to have just the search box ? Then click a button and redirect to another page with the map.
I haven't used it without the map, but I think you need to al least bound the SearchBox to an input and and then how you handle results is up to you, including redirecting to a different page.
I've followed this tutorial to plot markers from a database on my GMaps page. I have 2 type of markers (Green: marker status on my DB equals zero; Red: marker status on my database equals one) and I need to update the marker icon everytime a change is made on DB status column. I also want to adapt this code to add markers on map everytime I got a new line on my DB. The question is that I can't refresh the entire page, I'm allowed to refresh only the markers.
Someone know a way to do this? I'm using MySQL, PHP and JavaScript on my page.
You will have to use AJAX to do this. You can load the map via AJAX, and use setInterval() to reload the map and show the changes. In this way you are not reloading the page, you can reload just the contents of a <div> with the map's contents.
I have a page that uses ArcGIS Javascript when page loads first time, map on the page loads just fine. I have a drop down box that controllers what to show on the map and ajax event handler attached to that drop down box when some other option is being selected in that drop down box function
function ajaxOnComplete() { }
gets called. How in that function do I ask ArcGIS Javascript to reload its static map?
I know there's an accepted answer here, but there is a much easier way to refresh the layer of the map. When you refresh the extent of the map, all Layers will be newly loaded.
map.setExtent(map.extent);
This just loads the existing extent again and refresh the layers. I used this to reload the map after hiding the basemaplayers.
I figured it out!
function ajaxOnComplete()
{
map.destroy();
dojo.addOnLoad(init);
}
I keep running around in circles about a show/hide a DIV.
I have this website: http://fugados.tumblr.com. I have embedded a map between the header and the posts as an iframe.
I'm looking for a way (and I'm blocked about how to do it) to show the map only the first time you load the website. After the initial load, if you click in a post or a page, I want the map hidden, with a band/button/tab to press if you want to see/open the map.
The reason is that the map takes up a lot of space, and moves down the content too much. The first visit to the website it's ok to see that the map is there, but if you want to read the content of the website, the map in every page eats too much space.
Thank you!
I think the eseist way is to use Local storage.
Set it on first Load
localStorage.setItem('wasVisited', 1);
And then check if it exists
if (localStorage.wasVisidet !== undefined ) {/* hide map */}
You should use cookies.
First time when the page loads check if there is cookie value i.e. "hide_map" set to true. If yes, then hide the map. If not then don't hide the map but set the cookie "hide_map" value to true. This way the next time the user loads the page the "hide_map" will be true and you will hide the map.
Create an ID for the map.
Then use document.getElementById("mapid").style.display="none";
In this page: http://www.w3schools.com/js/js_cookies.asp it talks about your problem, you can tweek it instead of showing greetning, hide your map with simple jquery code $("#idofyourmap").hide();
EDIT: Just some background information - the system is set up using mySQL to store each marker's info, which is then converted into an XML file by some PHP code, which then displays it via the Maps javascript file. I currently have about 10 markers, which are stored in the mySQL database. Upon loading the map, all the markers are loaded.
I am currently using the Maps API v3 to display markers, and to display their infoWindows in a div. That's all good so far.
What I'd like to do it add a search functionality.
From what I understand, the API does have a search function, but when I tried it on the example in the documentation, it did a search across the whole map. I want it to only search amongst my markers.
EDIT: As I mentioned in the EDIT at the top, all markers are displayed at the initialize() - therefore, when someone searches for a location, the closest match would be selected. In the case of my map, the infowindow is displayed and split across 2 'html' sections, outside the map area (i.e., there is no bubble display on the actual map)
EDIT: Initially, I was worried that someone would come along and copy my idea if I posted the URL, but I'm sure it's been done already! Scr*w it - CityMap Prototype
So, I guess I'd need to find/create some sort of system that searches the XML file. Initially, the user would only be able to search for locations by name. Later, I'm sure I could come up with creative uses for the search.
Can anyone point me in the right direction?
EDIT:
After posting this, I found a tutorial on W3C - PHP Example - AJAX Live Search. It searches for links from an XML file, and then displays them in the temporary search results under the bar, as you type. Does anyone know how I can link this search function to the markers?
From what I can understand, I'd need to somehow link to each marker via XML, but that's the extent to my guess.
Thanks
From my understanding the api's search functionality is not for local files but for the whole map(world), if you are doing php I would recommend for the time being utilizing the tutorial you found and then linking the search functionality to performing some sort of javacript response which would perform the action which you are looking for upon search. I am not sure what this functionality is as you already would have the markers plotted on the map from the sound of your question. Let me know if you need more on this not sure if you are in a php/ruby/asp environment. (or if you are in a truly html environment) hth