나는 select2 드롭 다운 플러그인으로 작업 중입니다. 자동 메일에 기존 메일 ID가있는 select2 필드를 추가해야하는 상황이 발생했습니다. 그렇게 할 수 있었지만 같은 필드에있는 앱에없는 새 메일 ID를 추가해야합니다. 나는 그것을 해결할 수 없다. 아무도 나를 도와주세요.select2 드롭 다운 플러그인이 새 레코드 추가와 함께 자동으로 채워집니다.
여기 내보기 페이지 코드입니다.
<input type="hidden" class="select2 to_email w-100" name="to_email[]"
data-role="to_email" data-width="100%" data-placeholder="To" value="">
JS 코드 : 내가 아는
$('body').on('click','[data-button="reply-mail"],[data-click="reply"]', function() {
attach = [];
var $ti = $(this).closest('[data-role="row-list"]').find('[data-role="reply-mail-wrap"]');
var $to_this = $ti.find('[data-role="to_email"]');
var mail_toadr = $ti.find('input[name="to_addr"]').val();
$($to_this).select2({
placeholder: "Search for a contact",
minimumInputLength: 3,
//maximumSelectionLength: 1,
multiple : true,
ajax: {
url: Utils.siteUrl()+'mailbox/get_all_contacts',
type: 'POST',
dataType: 'json',
quietMillis: 250,
data: function (term, page) {
return {
term: term, //search term
page_limit: 100 // page size
};
},
results: function (data, page) {
return { results: data};
}
},
initSelection: function(element, callback) {
return $.getJSON(Utils.siteUrl()+'mailbox/get_all_contacts?email=' + (mail_toadr), null, function(data) {
return callback(data);
});
}
});
});
는, 예를 작업하는 당신에게 더 좋을 수 있지만, 미안 해요, 내가 그것을 할 방법을 모르겠어요. 작은 도움을 스크린 샷 :
http://awesomescreenshot.com/08264xy485이 친절하게 도와 ..