Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
novicell/dds / js / ajax-populate-dropdown-command.js
Size: Mime:
(function ($, Drupal) {
    /**
     * Add new command for reading a message.
     */
    Drupal.AjaxCommands.prototype.populateDropdown = function (ajax, response, status) {
        // Populate select
        var dropdown = $(response.selector);
        $(dropdown).find("option[value!='_none']").remove();
        dropdown.prev(".input-select").children(".input-select-options").html("").removeAttr("style");;
        dropdown.prev(".input-select").children(".input-select__label").html(dropdown.text());
        dropdown.prev(".input-select").children(".input-select-options").append($("<div />").addClass("input-select__border"));
        $.each(response.options, function (key, val) {
            dropdown.append($("<option />").val(key).text(val));
            dropdown.prev(".input-select").children(".input-select-options").append($("<li />").addClass("input-select-options__option").val(key).text(val));
        });
        dropdown.prev(".input-select").children(".input-select-options").append($("<li />").addClass("input-select-options__option input-select-options__option--none").data("value", "none").text(Drupal.t('None')));

    }
})(jQuery, Drupal);