.. _widgets-examples-dropdown:

Пример использования AS.SERVICES.showDropDown
""""""""""""""""""""""""""""""""""""""""""""""""

.. raw:: html

    <iframe src="../../_static/html/forms/widgets/dropdown.html" scrolling='no' frameBorder="0" height="200px" width="100%"></iframe>

Исходный код функции

.. code-block:: js

    $("[data-asformid='textbox.input.textbox-cmp']").click(function () {
        var values = [{
            value: "Queen",
            title: "ROCK"
        }, {
            value: "Oxxxymiron",
            title: "RAP"
        }, {
            value: "Филипп Киркоров",
            title: "POP"
        }];

        values.forEach(function (item) {
            if (item.value === model.getValue()) {
                item['selected'] = true;
            }
        });

        AS.SERVICES.showDropDown(values,
                $("[data-asformid='textbox.input.textbox-cmp']"),
                200,
                function (value) {
                    model.setValue(value);
                });
        });
    }

Полный исходный код

.. literalinclude:: ../../_static/html/forms/widgets/dropdown.html
    :language: html
    :emphasize-lines: 63-89
    :encoding: utf-8
