- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
var userDatatable = function (id) {
$('#datatable_users_container').removeClass('hide');
goToByScroll('datatable_users_container');
var dUser = $('#datatable_users').DataTable({
"responsive" : true,
"processing" : true,
"serverSide" : true,
"destroy" : true,
"ajax" : function (data, callback, settings) {
$.ajax({
url : api.institutions + '/' + id + '/users',
type : 'get',
data : {
'page' : $('#datatable_users').DataTable().page.info().page + 1,
'per_page' : data.length,
'order_by' : data.order[0].dir,
'sort_by' : data.columns[data.order[0].column].data,
},
dataType : 'json',
success : function (response) {
callback({
recordsTotal : response.meta.pagination.total,
recordsFiltered : response.meta.pagination.total,
data : response.data
});
// Görselde düzgün görünsün diye, son sütunu ortalar.
$('#datatable_users thead th:last').addClass('text-center');
$('#datatable_users tbody tr').each(function () {
$(this).find('td:last').addClass('text-center');
});
}
});
},
"columns" : [
{"data" : "identifier"},
{"data" : "fullName"},
{"data" : "email" },
{"data" : "userType", render : function (data, type, row, meta) {
if (row.userType == 0) return "Admin";
if (row.userType == 1) return "Şef";
if (row.userType == 2) return "Uzman";
}},
{"data" : "actions", render : function (data, type, row, meta) {
return '<div class="btn-group btn-group-circle btn-group-solid" style="position: relative !important;">' +
'<a href="/templates/'+row.identifier+'" class="btn btn-sm green"><i class="icon-magnifier"></i></a>' +
'<a href="/templates/edit/'+row.identifier+'" class="btn btn-sm yellow"><i class="icon-note"></i></a>' +
'<button class="btn btn-sm red remove-user" data-id="'+row.identifier+'"><i class="icon-trash"></i></button>' +
'</div>';
}},
],
"columnDefs" : [
{
"targets": 'no-sort',
"orderable": false
}
],
"bFilter" : false,
"sPaginationType": "full_numbers",
});
$('#datatable_users tbody').on('click', '.remove-user', function () {
var identifier = $(this).attr('data-id');
var dialog = bootbox.confirm({
size : 'small',
message : '<div class="text-center">Silmek istediğinize emin misiniz ?</div>',
buttons : {
confirm : {
label : ' Evet ',
className : 'red-mint'
},
cancel : {
label : 'Vazgeç',
className : 'grey-salsa'
}
},
callback : function (result) {
if (!result)
return;
$.ajax({
url : api.users + '/' + identifier,
type : 'delete',
dataType : 'json',
success : function (response) {
toastr.success('Çalışan <em>"'+response.data.fullName+'"</em> silindi.');
dUser.ajax.reload(null, false);
}
});
}
}).find('.modal-footer').css({'text-align' : 'center'});
});
};
当用户单击按钮时,我调用 userDatatable 并重新初始化数据表。第一次,当我点击数据表上的删除按钮时,bootbox 出现一次(一切正常)。但是如果我关闭数据表并再次初始化,这次当我点击数据表上的删除按钮时,bootbox 出现两次等等。
我想用数据表重新初始化bootbox。在 bootbox.confirm 调用之前,我尝试在点击事件中销毁模态。这次,确认按钮不起作用。
我怎样才能完全销毁 bootbox 并再次重新初始化。
最佳答案
那是因为你在函数 userDatatable
中绑定(bind)了 click
所以每次你调用它时,你都 add 绑定(bind)到按钮,所以在你之后刷新按钮上“有 2 个绑定(bind)”的数据表。
解决方法是在userDatatable
函数外绑定(bind)点击。
关于javascript - 破坏bootbox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47498394/
我正在尝试自定义 bootboxjs.prompt 选项,但它似乎不允许选项对象作为参数 这是来自 http://bootboxjs.com/index.html#api 的示例 bootbox.pr
我在同一个页面中有多个 bootbox.alert() 和 bootbox.confirm() 模态框需要清楚地添加不同的样式,但到目前为止运气不好,我如何为这些模态框定义我自己的样式类。 var a
我使用 bootbox 创建一个对话框,但我希望某些按钮仅在某些条件下显示。 我搜索了很多,但没有发现任何有用的信息.. 我这样定义引导箱: bootbox.dialog({ title: "t
bootbox 是否有一个选项可以在用户通过“x”按钮关闭对话框时调用一个函数?使用 bootbox.dialog() 时,我没有找到关于此的文档。 有没有这样的: bootbox.dialog({
不幸的是,Bootbox 文档 ( http://paynedigital.com/2011/11/bootbox-js-alert-confirm-dialogs-for-twitter-boots
如何在 Bootstrap 的 Bootbox 中拥有 2 个输入,而不是只有一个? 我需要在模式对话框中接收 2 个值。 最佳答案 实际上,有一种更简单的方法,不需要修改 bootbox 代码。 您
我已经在我的项目中下载了 bootbox.js 并实现了此代码来显示弹出模式对话框,但我的控制台中没有打印任何错误或成功结果。我对错误生成的位置感到困惑。 JS文件 $('switch input[t
我想知道是否有人可以帮助我编写一些代码。 我在某些模态窗口中使用 BootBox,我想向确认方法添加一些自定义 HTML,但我认为我做得不对。 我的代码如下: $('.next').click
我正在使用 Bootbox 为我的 Web 应用程序创建一个更漂亮的警报对话框。是否可以将警告对话框中的文本居中对齐? 最佳答案 您可以将此样式添加到您的 css 中: .modal-body {
Bootbox.js 是否有在成功显示对话框时调用函数的方法? 我原本打算用它来将一个隐藏的表单从页面的其他地方切换到 Bootbox 中,但是如果没有回调或回调类比,那是做不到的。然后我设计了一种将
任何人都知道如何解决这个问题。我有这段代码在删除文件时显示 bootbox.confirm,但它不起作用。 $('#fileupload').fileupload({ destroy: functio
我想显示一个带有引导框的文本区域元素。此文本区域应与 WYSIWYG 编辑器一起使用,它将由 $('#editor').redactor(); 所以我想在显示文本区域的那一刻添加它。我试过这个: bo
我正在动态创建一些表单,并且在 MVC5 应用程序中使用 bootbox 4 以及 bootstrap 3 和 jquery 3.1.0。 编辑:我将项目的 jquery 从 1.10.2 更新到 3
我正在尝试在 Twitter Bootstrap 模式对话框中加载 Facebook 登录按钮: $("a.fb-login, .modal a.fb-login").on("click", func
我想知道是否有一种方法可以动态更新 Bootstrap 框模态的内容。 例子 bootbox.dialog({ message: "Hi there", title:
我使用的是最新版本的 Bootbox,需要显示大量文本。文本溢出 Bootbox 模态窗口和浏览器。我需要包含的文本并在适当的时候带有垂直滚动条。我试过将消息包装在各种 html 元素中,但没有成功。
我正在为我的可过滤组合使用 bootstrap 3 和 bootbox.js,我希望能够在模式比浏览器窗口长时向下滚动,但你不应该能够滚动超过模式。 默认情况下,当您单击投资组合元素时,模式会滚动到页
我想在我的 Bootbox 警告框中换行。我知道在 Javascript 中你可以使用 \n 但这似乎不起作用。这是我尝试过的: bootbox.alert("Hello \n world"); 最佳
我正在尝试使用这个: $('#delete').live('click',function(){ var result; bootbo
我这里没有太多代码要展示,我使用 bootbox.js (http://bootboxjs.com/) 来发出警报,每次弹出警报时,页面都会滚动到顶部。任何想法如何防止它?我正在从一长串列表中删除项目
我是一名优秀的程序员,十分优秀!