Bootstrap 弹出窗口自定义模板不起作用
Bootstrap popover custom template not work
我正在尝试使用选项将自定义模板设置为弹出窗口,但从未添加该模板。为什么?这是代码。我需要那个方法才能工作,因为我不能使用方法 .popover(ecc..)
HTML:
<button type="button" data-loading-text="..." data-placement="bottom" id="selectRecipientsBtn"
data-toggle="popover" data-trigger="manual"
class="btn btn-default dropdown-toggle destinatariDiv">
<span class="caret"></span>
</button>
$('#selectRecipientsBtn').click(function(e) {
e.preventDefault();
loadManagers("<c:url value='/secure/send/managers' />");
});
function loadManagers(urlToLoad){ var popoverTemplate = '<div class="popover popover-managers"><div class="arrow"></div>'+
'<h3 class="popover-title"></h3><div class="popover-content">'+
'</div><div class="popover-footer"></div></div>';function loadManagers(urlToLoad) {
$("#selectRecipientsBtn").button('loading');
$.ajax({
type : 'GET',
url : urlToLoad,
success : function(data, status, xhr) {
$("#selectRecipientsBtn").button('reset');
$("#selectRecipientsBtn").data("bs.popover").options.html=true;
$("#selectRecipientsBtn").data("bs.popover").options.title='ciao';
$("#selectRecipientsBtn").data("bs.popover").options.trigger='manual';
$("#selectRecipientsBtn").data("bs.popover").options.content=data;
$("#selectRecipientsBtn").data("bs.popover").options.template= popoverTemplate;
$("#selectRecipientsBtn").popover("show");
},
error : function(xhr, status, error) {
alert("error");
},
});
}
你试过了吗:
$("#selectRecipientsBtn").popover({
title:'ciao',
trigger:'manual',
content:data,
template:popoverTemplate
});
$("#selectRecipientsBtn").popover("show");
$('#selectRecipientsBtn').popover({
html:true,
title: 'managers',
trigger : 'manual',
placement : 'bottom',
template: popoverMessageTemplate
});
$('#selectRecipientsBtn').click(function(e) {
e.preventDefault();
$("#selectRecipientsBtn").button('loading');
$.ajax({
type : 'GET',
url : "<c:url value='/secure/send/managers' />",
success : function(data, status, xhr) {
$("#selectRecipientsBtn").button('reset');
$("#selectRecipientsBtn").data("bs.popover").options.html=true;
$("#selectRecipientsBtn").data("bs.popover").options.content=data;
$("#selectRecipientsBtn").popover("show");
},
error : function(xhr, status, error) {
alert("error");
},
});
});
我正在尝试使用选项将自定义模板设置为弹出窗口,但从未添加该模板。为什么?这是代码。我需要那个方法才能工作,因为我不能使用方法 .popover(ecc..)
HTML:
<button type="button" data-loading-text="..." data-placement="bottom" id="selectRecipientsBtn"
data-toggle="popover" data-trigger="manual"
class="btn btn-default dropdown-toggle destinatariDiv">
<span class="caret"></span>
</button>
$('#selectRecipientsBtn').click(function(e) {
e.preventDefault();
loadManagers("<c:url value='/secure/send/managers' />");
});
function loadManagers(urlToLoad){ var popoverTemplate = '<div class="popover popover-managers"><div class="arrow"></div>'+
'<h3 class="popover-title"></h3><div class="popover-content">'+
'</div><div class="popover-footer"></div></div>';function loadManagers(urlToLoad) {
$("#selectRecipientsBtn").button('loading');
$.ajax({
type : 'GET',
url : urlToLoad,
success : function(data, status, xhr) {
$("#selectRecipientsBtn").button('reset');
$("#selectRecipientsBtn").data("bs.popover").options.html=true;
$("#selectRecipientsBtn").data("bs.popover").options.title='ciao';
$("#selectRecipientsBtn").data("bs.popover").options.trigger='manual';
$("#selectRecipientsBtn").data("bs.popover").options.content=data;
$("#selectRecipientsBtn").data("bs.popover").options.template= popoverTemplate;
$("#selectRecipientsBtn").popover("show");
},
error : function(xhr, status, error) {
alert("error");
},
});
}
你试过了吗:
$("#selectRecipientsBtn").popover({
title:'ciao',
trigger:'manual',
content:data,
template:popoverTemplate
});
$("#selectRecipientsBtn").popover("show");
$('#selectRecipientsBtn').popover({
html:true,
title: 'managers',
trigger : 'manual',
placement : 'bottom',
template: popoverMessageTemplate
});
$('#selectRecipientsBtn').click(function(e) {
e.preventDefault();
$("#selectRecipientsBtn").button('loading');
$.ajax({
type : 'GET',
url : "<c:url value='/secure/send/managers' />",
success : function(data, status, xhr) {
$("#selectRecipientsBtn").button('reset');
$("#selectRecipientsBtn").data("bs.popover").options.html=true;
$("#selectRecipientsBtn").data("bs.popover").options.content=data;
$("#selectRecipientsBtn").popover("show");
},
error : function(xhr, status, error) {
alert("error");
},
});
});