-1

我正在尝试使用选项将自定义模板设置为弹出框,但从未添加过该模板。为什么?这是代码。我需要这种方法才能工作,因为我不能使用方法 .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");
    },
});

}
4

2 回答 2

3

你有没有尝试过:

$("#selectRecipientsBtn").popover({
    title:'ciao',
    trigger:'manual',
    content:data,
    template:popoverTemplate
});
$("#selectRecipientsBtn").popover("show");
于 2015-02-17T19:46:31.127 回答
0
$('#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");
        },
    });
});
于 2015-02-17T21:19:19.130 回答