Version:
Popular examples
Map
Geo objects
Balloon and hint
Controls
Hotspots
Regions
Clustering
GeoQuery
Behaviors and events
Search on a map
Traffic
User's location
Routing
YMapsML
GeoXML
ObjectManager
Modular system
Panoramas
External modules

Creating a custom drop-down list layout

Save as filesEdit on JSFiddle

Object layouts can be created using the templateLayoutFactory factory and text templates.

This example creates a custom layout for the drop-down list. The layout of the control is based on its data, status, and options. The layout is automatically rebuilt when changes are made to the values of fields, states, or options that are used in its text template.

A drop-down list by default responds to a click on its layout and changes the value of the field state.get('expanded').

Layout events that the drop-down list responds to are described in the interfaces IExpandableControlLayout and IGroupControlLayout.

The drop-down list is a group control, so its layout must generate the events and implement the methods described in IGroupControlLayout.

You can use options to make settings for the drop-down list itself, as well as for its child elements. To do this, specify the prefix 'item' for the child elements.