Commits

stefano cudini  committed 3f63326 Draft

add new demo for custom callData

  • Participants
  • Parent commits 07aef5a

Comments (0)

Files changed (9)

File dist/leaflet-search.min.css

 /* 
- * Leaflet Search Control v1.5.0 - 2014-04-15 
+ * Leaflet Search Control v1.5.0 - 2014-04-17 
  * 
  * Copyright 2014 Stefano Cudini 
  * stefano.cudini@gmail.com 

File dist/leaflet-search.min.js

 /* 
- * Leaflet Search Control v1.5.0 - 2014-04-15 
+ * Leaflet Search Control v1.5.0 - 2014-04-17 
  * 
  * Copyright 2014 Stefano Cudini 
  * stefano.cudini@gmail.com 

File dist/leaflet-search.mobile.min.css

 /* 
- * Leaflet Search Control v1.5.0 - 2014-04-15 
+ * Leaflet Search Control v1.5.0 - 2014-04-17 
  * 
  * Copyright 2014 Stefano Cudini 
  * stefano.cudini@gmail.com 

File dist/leaflet-search.mobile.src.css

 /* 
- * Leaflet Search Control v1.5.0 - 2014-04-15 
+ * Leaflet Search Control v1.5.0 - 2014-04-17 
  * 
  * Copyright 2014 Stefano Cudini 
  * stefano.cudini@gmail.com 

File dist/leaflet-search.src.css

 /* 
- * Leaflet Search Control v1.5.0 - 2014-04-15 
+ * Leaflet Search Control v1.5.0 - 2014-04-17 
  * 
  * Copyright 2014 Stefano Cudini 
  * stefano.cudini@gmail.com 

File dist/leaflet-search.src.js

 /* 
- * Leaflet Search Control v1.5.0 - 2014-04-15 
+ * Leaflet Search Control v1.5.0 - 2014-04-17 
  * 
  * Copyright 2014 Stefano Cudini 
  * stefano.cudini@gmail.com 

File examples/ajax-jquery.html

 			type: 'GET',
 			data: {q: text},
 			dataType: 'json',
-			success: callResponse
+			success: function(json) {
+				callResponse(json);
+			}
 		});
 	}
 

File examples/calldata.html

+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
+<html xmlns="http://www.w3.org/1999/xhtml"> 
+<head> 
+<title></title> 
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
+<link rel="stylesheet" href="/maps/leaflet/dist/leaflet.css" />
+<link rel="stylesheet" href="../src/leaflet-search.css" />
+<link rel="stylesheet" href="../style.css" />
+</head>
+
+<body>
+<h3><a href="../"><big>◄</big> Leaflet.Control.Search</a></h3>
+
+<h4>Static data Example: <em>search locations using option callData in static Array</em></h4>
+<div id="map"></div>
+
+<div id="post-it">
+<b>Search values:</b><br />
+black, blue, cyan, darkblue, darkred, darkgray, gray, gree, red, yellow, white
+</div>
+
+<script src="/maps/leaflet/dist/leaflet.js"></script>
+<script src="../src/leaflet-search.js"></script>
+<script>
+
+
+	//sample data values for populate map
+	var data = [
+		{"loc":[41.575330,13.102411], "title":"aquamarine"},
+		{"loc":[41.575730,13.002411], "title":"black"},
+		{"loc":[41.807149,13.162994], "title":"blue"},
+		{"loc":[41.507149,13.172994], "title":"chocolate"},
+		{"loc":[41.847149,14.132994], "title":"coral"},
+		{"loc":[41.219190,13.062145], "title":"cyan"},
+		{"loc":[41.344190,13.242145], "title":"darkblue"},	
+		{"loc":[41.679190,13.122145], "title":"darkred"},
+		{"loc":[41.329190,13.192145], "title":"darkgray"},
+		{"loc":[41.379290,13.122545], "title":"dodgerblue"},
+		{"loc":[41.409190,13.362145], "title":"gray"},
+		{"loc":[41.794008,12.583884], "title":"green"},	
+		{"loc":[41.805008,12.982884], "title":"greenyellow"},
+		{"loc":[41.536175,13.273590], "title":"red"},
+		{"loc":[41.516175,13.373590], "title":"rosybrown"},
+		{"loc":[41.506175,13.173590], "title":"royalblue"},
+		{"loc":[41.836175,13.673590], "title":"salmon"},
+		{"loc":[41.796175,13.570590], "title":"seagreen"},
+		{"loc":[41.436175,13.573590], "title":"seashell"},
+		{"loc":[41.336175,13.973590], "title":"silver"},
+		{"loc":[41.236175,13.273590], "title":"skyblue"},
+		{"loc":[41.546175,13.473590], "title":"yellow"},
+		{"loc":[41.239190,13.032145], "title":"white"}
+	];
+
+	var map = new L.Map('map', {zoom: 9, center: new L.latLng(data[0].loc) });
+
+	map.addLayer(new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'));	//base layer
+
+	function localData(text, callResponse)
+	{
+		//here can use custom criteria or merge data from multiple layers
+
+		callResponse(data);
+	}
+
+	map.addControl( new L.Control.Search({callData: localData, text:'Color...', markerLocation:true}) );
+
+</script>
+
+<div id="copy"><a href="http://labs.easyblog.it/">Labs</a> &bull; <a rel="author" href="http://labs.easyblog.it/stefano-cudini/">Stefano Cudini</a></div>
+	
+</body>
+</html>
 		<li><a href="examples/geojson-layer.html">GeoJSON features</a></li>
 		<li><a href="examples/ajax.html">Ajax</a></li>
 		<li><a href="examples/jsonp.html">Jsonp</a></li>
-		<li><a href="examples/ajax-jquery.html">Ajax by jQuery</a></li>		
+		<li><a href="examples/ajax-jquery.html">Ajax by jQuery</a></li>
+		<li><a href="examples/calldata.html">Static data</a></li>
 		<li><a href="examples/jsonp-filtered.html">Jsonp Filtered</a></li>
 		<li><a href="examples/ajax-bulk.html">Bulk data</a></li>
 		<li><a href="examples/custom-tip.html">Custom Tip Item</a></li>