2.1.2 • Published 5 years ago

leaflet-search-control v2.1.2

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

Leaflet Search

Leaflet Search is an easy-to-configure search plugin for leaflet.

Demo: click here


Requirements:

  • Leaflet
  • FontAwesome

Installation:

via npm:

npm install leaflet-search-control --save

old fashioned way:

download the repository and add the files inside src folder to your project.

Use:

var search = L.control.search({

                 placeholder : 'Search',            //search input placeholder   
                 minNumberOfCharacters : 0,         //min number of characters user has to type before search callback is called    
                 searchOnEnter : true,              //search when user type enter  
                 noResults : 'No Records Found',    //custom text when no result is found
            
                 search: function(control, value) {
                     
                     control.setResults([
                         {title: 'Item 1'},
                         {title: 'Item 2', icon: 'fa fa-search'},
                         {title: 'Item 3', imgIcon: 'img/icon.png'},
                         {title: 'Item with Super Long Text', icon: 'fa fa-search', imgIcon: 'img/icon.png'}
                     ]);
                     
                 },
                 
                 selected: function(item) {
                    console.log(item);
                 }
             });

search.addTo(map);
2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.7

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago