Answer the question
In order to leave comments, you need to log in
How to style search field in yandex maps api?
The Yandex Maps API has a ymaps.control.SearchControl
. You need to change its appearance a little - the font, the color of the backdrop, the indents. At the same time, I would like not to lose the existing functionality (hint when entering, search by pressing Enter).
I suspect that you need to change the property formLayout
, but what arguments are available in it and how to reuse the drop-down list of hints is not clear.
Is there an example somewhere on how this is done?
Answer the question
In order to leave comments, you need to log in
Figured out how to do it. Perhaps someone will come in handy.
1. We make up the form the way it should look.
2. Create a template using ymaps.templateLayoutFactory.createClass
.
3. In the method , we build
subscribe to the event submit
of the form, in the handler we do the following:
searchCallback: function(e) {
e.preventDefault();
var ctrl = this.getData().control;
ctrl.search($('#search-field').val());
}
ymaps.SuggestView
, pass it the id of the search field (without the grid).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question