stefano cudini committed 5529f34 Draft

update README with short example

Comments (0)

Files changed (2)

 map.addControl( new L.Control.Search({layer: searchLayer}) );
 //searchLayer if a L.LayerGroup contains searched markers
+short way:
+var map = new L.Map('map', { searchControl: {layer: searchLayer} });
 other examples:


 		//TODO add option collapsed, like control.layers
 //FIXME option condition problem {autoCollapse: true, markerLocation: true} not show location
-//FIXME option condition problem {autoCollapse:false }
+//FIXME option condition problem {autoCollapse: false }
 	initialize: function(options) {
-		L.Util.setOptions(this, options);
+		L.Util.setOptions(this, options || {});
 		this._inputMinSize = this.options.text ? this.options.text.length : 10;
 		this._layer = this.options.layer || new L.LayerGroup();
 		this._filterJSON = this.options.filterJSON || this._defaultFilterJSON;
 		// map.on({
 		// 		'layeradd': this._onLayerAddRemove,
 		// 		'layerremove': this._onLayerAddRemove
-		// 	}, this);		
+		// 	}, this);
 		return this._container;
 L.Map.addInitHook(function () {
     if (this.options.searchControl) {
-        this.searchControl =;
+        this.searchControl =;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.