Редактируемый в X тип настраиваемого поля, не учитывающий переопределенные значения по умолчанию

У меня есть пользовательский тип ввода x-editable для ввода города и выбора страны, которая выглядит так:

Обратите внимание на кнопки внизу; Это так, потому что код инициализации содержит:showbuttons: 'bottom'

$('#location').editable({
    url: '/post',
    title: 'Enter city and country',
    showbuttons: 'bottom',
    value: {
        city: "Napier",
        country: "nz"
    },
    sourceCountry: [
        {value: "af", text: "Afghanistan"},
        ...
        {value: "zw", text: "Zimbabwe"}
    ]
});

Но для этого виджета нет смысла рендерить кнопки сбоку; поэтому я хотел, чтобы кнопки были там по умолчанию; Поэтому я попытался установить значение по умолчанию для этого редактируемого типа:

Location.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
    tpl: '' +
        '' +
        '<span>City: </span>' +
        '' +
        '' +
        '<span>Country: </span>' +
        '',

    inputclass: '',
    showbuttons: 'bottom',
    sourceCountry: []
});

Ноshowbuttons ключ игнорируется; остальные применяют штраф, но не этот. Итак, как я могу установить значение по умолчанию для редактируемого типа?

Вот's редактируемый код,

(function ($) {
    "use strict";

    var Location = function (options) {
        this.sourceCountryData = options.sourceCountry;
        this.init('location', options, Location.defaults);
    };

    //inherit from Abstract input
    $.fn.editableutils.inherit(Location, $.fn.editabletypes.abstractinput);

    $.extend(Location.prototype, {

        render: function () {
            this.$input = this.$tpl.find('input');
            this.$list = this.$tpl.find('select');

            this.$list.empty();

            var fillItems = function ($el, data) {
                if ($.isArray(data)) {
                    for (var i = 0; i < data.length; i++) {
                        if (data[i].children) {
                            $el.append(fillItems($('', {
                                label: data[i].text
                            }), data[i].children));
                        } else {
                            $el.append($('', {
                                value: data[i].value
                            }).text(data[i].text));
                        }
                    }
                }
                return $el;
            };

            fillItems(this.$list, this.sourceCountryData);


        },

        value2html: function (value, element) {
            if (!value) {
                $(element).empty();
                return;
            }
            var countryText = value.country;
            $.each(this.sourceCountryData, function (i, v) {
                if (v.value == countryText) {
                    countryText = v.text.toUpperCase();
                }
            });
            var html = $('').text(value.city).html() + ' / ' + $('').text(countryText).html();
            $(element).html(html);
        },

        html2value: function (html) {
            return null;
        },

        value2str: function (value) {
            var str = '';
            if (value) {
                for (var k in value) {
                    str = str + k + ':' + value[k] + ';';
                }
            }
            return str;
        },

        str2value: function (str) {
            return str;
        },

        value2input: function (value) {
            if (!value) {
                return;
            }
            this.$input.filter('[name="city"]').val(value.city);
            this.$list.val(value.country);
        },

        input2value: function () {
            return {
                city: this.$input.filter('[name="city"]').val(),
                country: this.$list.val()
            };
        },

        activate: function () {
            this.$input.filter('[name="city"]').focus();
        },

        autosubmit: function () {
            this.$input.keydown(function (e) {
                if (e.which === 13) {
                    $(this).closest('form').submit();
                }
            });
        }
    });

    Location.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
        tpl: '' +
            '' +
            '<span>City: </span>' +
            '' +
            '' +
            '<span>Country: </span>' +
            '',

        inputclass: '',
        showbuttons: 'bottom', //WHY ISN'T THIS WORKING!!!
        sourceCountry: []
    });

    $.fn.editabletypes.location = Location;

}(window.jQuery));

Ответы на вопрос(1)

Ваш ответ на вопрос