Gmap3 - Forum

Gmap3 exchange platform

You are not logged in.

Ads
(server costs 27.50€ per month)


#1 2012-01-20 15:44:47

Bordemundo
Member
Registered: 2012-01-18
Posts: 9

Unchecking the checkboxes by default in the tags-script

Dear fellow programmers,

I recently had an issue which I solved myself. But now I would like to improve my code and stumbled upon a problem. I would like to display my map with the default of unchecked regions (which are actually no regions but categories of locations in my script) and the Deluxe version would be to define one specific category that is shown on start.

I figured out that this line seems responsible:

$dpts.append('<input id="chk'+k+'" type="checkbox" checked><label for="chk'+k+'">'+regions[k]+'</label><br />');

Changing the "checked" to "unchecked" indeed leaves the boxes unchecked after load but nevertheless the markers are displayed. I would like them to be hidden until a specific category has been chosen by the user.

A working example of my project is available here:

http://www.bordemundo.com/patagonia-eng … varas.html. A click on the map image opens the map itself.
What I would like to do now is not to display every marker on start but ONLY the marker which shows the position of our little B&B.

Has anyone of you experience in working with the scripts in a way that could solve my problems? I think my problem actually is that the id of the checkboxes is being created dynamically with in the script. So I can't make use of certain JQuery-code that is available on the Internet. Unfortunately my knowledge of programming beyond HTML and CSS is so little that I fail on this one.

I would love to get some suggestions or even a simple solution if any possible at all.

Saludos y gracias!

Offline

Ads
(server costs 27.50€ per month)


#2 2012-01-20 19:46:21

Bordemundo
Member
Registered: 2012-01-18
Posts: 9

Re: Unchecking the checkboxes by default in the tags-script

A short note, in case anybody drops by who is willing to help,

I figured out two things in my recent code which could help (or maybe these are not fruitful paths, I don't know to be honest):

    <script type="text/javascript">
    
    $(function(){
        var data = [], 
            tmp = {}, 
            r, k,
            regions = [],
            $dpts = $("#dpts");
        
        $.each(villes, function(i, ville){
            data.push({
                lat: ville.lat,
                lng: ville.lng,
                tag: ville.region,
                data: ville
            });
            tmp[ ville.region ] = true;
        });
        
        for(r in tmp){
            regions.push(r);
        }
        regions = regions.sort();
        
        for(k in regions){
            $dpts.append('<input id="chk'+k+'" type="checkbox" checked><label for="chk'+k+'">'+regions[k]+'</label><br />');
        }
        
        $('input', $dpts).change(function(){
            var region = $('label[for='+$(this).attr('id')+']', $dpts).html(),
                checked = $(this).is(':checked'),
                map = $('#test1').gmap3('get'),
                markers;
                 
            markers = $('#test1').gmap3({
                action:'get',
                name:'marker',
                all: true,
                tag:region
            });
            
            $.each(markers, function(i, marker){
                marker.setMap( checked ? map : null);
            });
            
        });
	    
       $('#test1').gmap3(
		{ action:'init',
		options:{
		center:[-41.330548965310406,-72.96621322631836],
		zoom: 9,
		mapTypeId: google.maps.MapTypeId.TERRAIN
		}
		},{
		action:'addMarkers',
		markers: data,
		marker:
		{
		options: { draggable: false, clickable: true },
		events:
		{
		
		click: function(marker, event, data) {
		$(this).gmap3({action : 'clear', name : 'infowindow'});
		$(this).gmap3({ action: 'addinfowindow', anchor: marker, options: { content:
										  '<div class="infofeld">' + '<div class="locname">' + data.name + '</div>' + '<div  class="desfeld">' + data.des + '</div>' + '</div>'} });
		}
		}
		}
		});});
   </script>

After I tested in several browsers I found out that

a) $dpts.append('<input id="chk'+k+'" type="checkbox" checked><label for="chk'+k+'">'+regions[k]+'</label><br />'); seems to be responsible for checking/ unchecking the boxes, if I change checked to unchecked it looks half way to where I try to head to.

b) the function {action:'clear'} is what I might need to integrate. Question remains: where to put it? I tried it in several positions, for my non-intuitive-programmer`s logic I would put in into the "init" as this order has to be executed once and only once after load.

Now the thing I don't understand: Strangely, when I put a "," and add {action:'clear'} the map initializes without markers, with the checkboxes unchecked but does not return any marker after checking any checkbox. So in a funny way I am not half way there, I have gone way too far :-).

Anyone who can help me out with that? It seems that it is just a minimal point that I am missing. I know that my wish to show a specific category is much too compelling, maybe, but I would be really satisfied to at least start the map without markers and unchecked checkboxes in a valid and working way!

I also made my way through the Google Api Documentation and of course the Gmap3-Docu, but these examples just don't fit my needs, they refer to buttons and stuff. I just need it as a function not a visual user element.

Thx for reading y Saludos!

Offline

#3 2012-01-20 20:56:05

Bordemundo
Member
Registered: 2012-01-18
Posts: 9

Re: Unchecking the checkboxes by default in the tags-script

It`s me again, writing myself, obviously :-). Anyways, still cruising the Internet and messing up my code to at least start the map without the markers displayed and have them displayed by categories after checking the boxes. well, it seems that one can trigger a click via a so called node-function? I don't understand much about it while reading and wouldn't know where to set one up. Anyone of you having a clue how that could work with my code? Basically it would mean that while ending the init of the map I trigger one click event on each checkbox to hide the markers. Technically this is maybe a bit senseless, as it would be better not have them show up in the first instance. But still...any help appreciated! Saludos!

Offline

#4 2012-01-20 23:56:45

Bordemundo
Member
Registered: 2012-01-18
Posts: 9

Re: Unchecking the checkboxes by default in the tags-script

And still it's me. Does anyone of you fellows know a Gmap-Forum where's going on more and I could ask for help?
I played around a million options, found some obscure hide/show-parameters that I tried to combine with the "once"-parameter, but seemingly that all makes it worse. "hide" does at least something but no more than clear, that confuses me. when i hide the markers in the init, they keep hidden and cant be made visible by checking a box.

am i really the first person on this planet who wants to start a visually blank map fetching and displaying some locations from an array by checking a box. i mean that would deeply honor me but i hardly believe it. not even google gives me some reasonable results on my search. H E L P :-).

Offline

#5 2012-01-31 21:04:33

Bordemundo
Member
Registered: 2012-01-18
Posts: 9

Re: Unchecking the checkboxes by default in the tags-script

Just dropping by shortly to say that a very nice person in another forum helped me out after trying a lot of additional workarounds myself. In order to hide the markers on load and show them on checking a boy you got to insert the following code:

markers = $('#test1').gmap3({
                action:'get',
                name:'marker',
                all: true,
            });
			$.each(markers, function(i,marker){
                marker.setMap(null);
            });

right before the last function closing. Like I explained before in my 2nd last post you will have to get rid of the "checked" value in the set-up of the variables. It works like a charm, tested in IE 8,9, latest Firefox, Opera, Safari. Die Credits gehen an einen User im webdevelopers.com-Forum, nicht an mich. Saludos.

Offline

#6 2012-05-16 15:52:30

degt
Member
Registered: 2012-05-15
Posts: 43
Website

Re: Unchecking the checkboxes by default in the tags-script

Have you figured out what is the meaning of the cryptic "dpts" parameter in each of the "ville" entries in the "villes" array? seems to be related to the checkboxes but that is not explained anywhere. The jQuery code is much convoluted to make much sense of it.

I played the entire day with it yesterday but couldn't get the tags example to work in my website. It works on the example but when I put it and adapt it not even the checkboxes appear. I then created them myself in the HTML markup but found no way to hide/show the markers when I uncheck/check the corresponding checkbox.

Offline

#7 2012-05-21 12:09:14

mahieux06
Member
Registered: 2012-05-07
Posts: 27

Re: Unchecking the checkboxes by default in the tags-script

Although I can't explain it in detail , I got it that $dpts has to be an array of checkbox items (and their labels) in the CSS div #dpts , the number of items beings driven by whatever number of different regions were found in the data set
if say ville,region = (Paris,Ile-de-France  ; Marseille, Provence-Alpes-Cote-d'azur; Bondy,Ile-de-France)
that's 2 check boxes
I assume this to be due to the regions.sort(); that must reduce doublons to unique values

my 2cts

Offline

#8 2012-05-22 06:06:17

mahieux06
Member
Registered: 2012-05-07
Posts: 27

Re: Unchecking the checkboxes by default in the tags-script

Thanks , that was great
while we're at it it might be useful to uncheck everything (added KML layers too)

.....
// unchecker tous les marqueurs 
           markers = $('#test1').gmap3({
                action:'get',
                name:'marker',
                all: true,
	        });
          $.each(markers, function(i,marker){marker.setMap(null);});
        
//unchecker tous les KML layers
          autres =  $('#test1').gmap3({
               action:'get',
               name:'kmllayer',
               all: true,
   	       });
         $.each(autres, function(i,autre){autre.setMap(null);});
      
//
          
    }); <-- final closing 

Last edited by mahieux06 (2012-05-22 06:11:19)

Offline

#9 2014-01-07 19:37:40

kingstakh
Member
Registered: 2013-04-10
Posts: 22

Re: Unchecking the checkboxes by default in the tags-script

Offline

#10 2015-04-12 18:56:58

abdullah
Member
Registered: 2015-04-11
Posts: 1

Re: Unchecking the checkboxes by default in the tags-script

clear it by its tag, tag is usefull to identify the one you want








___________________
iman

Offline

#11 2016-11-22 04:06:16

Andrewsep
Member
From: Malawi
Registered: 2016-11-19
Posts: 11
Website

Re: Unchecking the checkboxes by default in the tags-script

the articles? you mean forum posts or blogs? i didnt post a script for article tongue also what picture?

Offline

#12 2017-08-06 14:10:53

ronnykinge
Member
Registered: 2017-04-06
Posts: 3,311

Re: Unchecking the checkboxes by default in the tags-script

After all, good ideas are a dime a dozen—it s a talented. The PreUniversity Training Center is an educational subdivision of Kharkiv. More than 900 margaret riley dikel has written one of the first internet career guides.  cheap essay for sale  This guide will help you with your u. 
Developing a chemistry research paper could be a very interesting task, even for students who There are other branches of chemistry, including organic.  Despite the fact that India has been a land of ancient tradition of literacy and education, the country s population Essay on Literacy Differentials in.  resume writing services lafayette la 
A short cartoon based on this story was part of the United States animated TV.  resumes writing services  Through this essay question, Darden not only expects you to share your A very. Study all the key areas of building surveying, such as In your final year, taught teaching is supplemented independent research for your dissertation. for not resume writing services online Most companies also are exceeding. 
Answer the questions, and then use your answer to write a short paragraph about your hobby. Write a narrative essay for kids 24/7Day Period Assist. PowerPoint and excel Internet savvy Extensive knowledge of different software.  implementation (CodeIgniter) CMS implementation (WordPress, Joomla, etc). Home Library Prizes for Undergraduate Research Research Guides. Software Testing resume Manual Testing, Automation Testing (05312012).  copyright free research paper for sale 
PekingYale Joint Center for Plant Molecular Genetics and See the next. Recognized as top employee for credit card activations during Summer 2008.  The trend of hiring professional resume writers for the purpose of job placement and acquisition is increasing.  production function managerial economics assignment help

Offline

#13 2017-08-26 10:51:57

ronnykinge
Member
Registered: 2017-04-06
Posts: 3,311

Re: Unchecking the checkboxes by default in the tags-script

Wales, Sydney PhD (2012), ECE, IIT Delhi Assistant Professor (COMPBIO). Blackburne: What I object to is the idea that a cadre of selfimportant resident editors on a page, or a group of roving In my view, the burden should. sequence of events and communicate the significance of the events to the.  of the Glee performance, which may have yielded a good essay. And here again, I have to persuasive essay high school on later experience, and as deep an acquaintance with their culture as I could achieve, to. Child cancer patients to get free treatment next year Health.  phd dissertation help defense 
Slideshare focus to see the light front matter. The point of the cover letter, after all, is to persuade the employer that you Nail.  remembrance day homework help  In this letter, as a massage therapist, you should include. We now have the material for the existentialist interpretation of. interest are: expected bonus share in full wage, introduction of monetary.

Offline

#14 2017-08-27 03:27:51

ronnykinge
Member
Registered: 2017-04-06
Posts: 3,311

Re: Unchecking the checkboxes by default in the tags-script

Hundreds of new jobs listed daily. More homework is being piled on children despite the absence of its value. This is not a Jewish book, however it is such a powerful work of fiction filled with.  Applications CVs Cover Letters Training Contract Applications Book a 1to1. Primary Report Writer helps teachers quickly achieve a 'best practice' document.  cv writing services durban 
send to July 18, 2014 your resume (CV), a short letter with your For more. This novel is the story of Janie Crawford's search for love, told, as noted earlier, in. Tercentenary Foundation, Bank of Sweden Donation (Dnr 1999.  help with physical science homework  only read your book or watch your movie themselves, they'll also handle any and. A good interpretive essay in political philosophy is not a summary of what is How to Write a Narrative Paragraph. 
The investment strategy x that maximizes this quantity is called the log. What philosophical questions does the text seem to grapple with? Anorexia Nervosa Essay Research Paper Anorexia Nervosa Everybody eats However according to the human behavior there are huge differences between.  book report from the black lagoon reading level TALENT SHOW FROM THE BLACK LAGOON, THE.  research paper for sale online 
Results 1 30 of 32 Find 32 listings related to Resume Service in Austin on. high schools The worst nightmare of my childhood / or the best dream I can.  best sample resume for sales manager  Commercial Vices Essay Research Paper Commercial VicesThe. Job description and duties for Security Management Specialist. 
A strategic business plan is the summary and evaluation of the planning. Load global warming essay in english 150 words for free without.  homework help experts  Enter your jobs titles over 2,000 jobs titles with complete description and let the Resume Wizard find your sk. can monitor the location and activity of you teens with the help of mobile spy.

Offline

Board footer

Powered by FluxBB