msearch2
Нашел код в 'assets/components/msearch2/js/web/default.js'
mSearch2.Form = {
initialized: false,
initialize: function (selector) {
if (this.initialized || typeof(mse2FormConfig) == 'undefined') {
return false;
}
$(selector).each(function () {
var form = $(this);
var config = mse2FormConfig[form.data('key')];
var cache = {};
if (config.autocomplete == '0' || config.autocomplete == 'false') {
return false;
}
else if (!$.ui || !$.ui.autocomplete) {
return mSearch2.loadJQUI(mSearch2.Form.initialize, selector);
}
form.find('input[name="' + config['queryVar'] + '"]').autocomplete({
source: function (request, callback) {
if (request.term in cache) {
callback(cache[request.term]);
return;
}
var data = {
action: 'search',
key: form.data('key'),
pageId: config.pageId
};
data[config['queryVar']] = request.term;
//noinspection JSUnresolvedFunction
$.post(mse2Config['actionUrl'], data, function (response) {
if (response['data']['log']) {
$('.mSearchFormLog').html(response['data']['log']);
}
else {
$('.mSearchFormLog').html('');
}
cache[request.term] = response['data']['results'];
callback(response['data']['results'])
}, 'json');
},
minLength: config['minQuery'] || 3,
select: function (event, ui) {
if (ui.item.url) {
document.location.href = ui.item.url;
}
else {
setTimeout(function () {
form.submit();
}, 100);
}
}
}).data("ui-autocomplete")._renderItem =
function (ul, item) {
//$('<a href="/catalog/"> Посмотреть все </a>').appendTo('.ui-front');
$( ".ui-front" ).append( "<p>Test</p>" );
return $('<li>')
.data("item.autocomplete", item)
.addClass("mse2-ac-wrapper")
.append($("<div>").addClass('mse2-ac-link').html(item.label))
//.append("<a class=\"mse2-ac-link\">" + item.label + "</a>")
.appendTo(ul);
};
//noinspection JSPotentiallyInvalidConstructorUsage,JSUnresolvedVariable
jQuery.ui.autocomplete.prototype._resizeMenu = function () {
var ul = this.menu.element;
ul.outerWidth(this.element.outerWidth());
};
return true;
});
this.initialized = true;
}
};
Приписываю кнопку разными способами, не выходит…Она дублируется на каждый item выпадающего списка. А кнопка нужна в самом низу!
Комментарии: 1
Вы документацию открывали?
mSearch2
Сниппет для поиска и вывода результатов.
В работе использует pdoTools, поэтому обладает всеми основными возможностями: подключение ТВ, таблиц, указание условий в &where, &select и т.д.
mSearch2
Сниппет для поиска и вывода результатов.
В работе использует pdoTools, поэтому обладает всеми основными возможностями: подключение ТВ, таблиц, указание условий в &where, &select и т.д.
Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.