1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-18 07:44:54 +00:00
calibre-web/cps/static/js/table.js

59 lines
1.9 KiB
JavaScript
Raw Normal View History

2018-08-28 07:42:19 +00:00
$(function() {
$("#domain_submit").click(function(event) {
2018-08-28 07:42:19 +00:00
event.preventDefault();
$("#domain_add").ajaxForm();
$(this).closest("form").submit();
$.ajax({
method:"get",
url: window.location.pathname + "/../../ajax/domainlist",
async: true,
timeout: 900,
success:function(data){
$('#domain-table').bootstrapTable("load", data);
}
});
});
$("#domain-table").bootstrapTable({
formatNoMatches: function () {
return "";
},
striped: false
2018-08-28 07:42:19 +00:00
});
$("#btndeletedomain").click(function() {
//get data-id attribute of the clicked element
var domainId = $(this).data("domainId");
2018-08-28 07:42:19 +00:00
$.ajax({
method:"post",
url: window.location.pathname + "/../../ajax/deletedomain",
data: {"domainid":domainId}
});
$("#DeleteDomain").modal("hide");
2018-08-28 07:42:19 +00:00
$.ajax({
method:"get",
url: window.location.pathname + "/../../ajax/domainlist",
async: true,
timeout: 900,
success:function(data){
$("#domain-table").bootstrapTable("load", data);
2018-08-28 07:42:19 +00:00
}
});
});
//triggered when modal is about to be shown
$("#DeleteDomain").on("show.bs.modal" function(e) {
2018-08-28 07:42:19 +00:00
//get data-id attribute of the clicked element and store in button
var domainId = $(e.relatedTarget).data("domain-id");
$(e.currentTarget).find("#btndeletedomain").data("domainId", domainId);
2018-08-28 07:42:19 +00:00
});
});
function TableActions (value, row, index) {
return [
"<a class=\"danger remove\" data-toggle=\"modal\" data-target=\"#DeleteDomain\" data-domain-id=\"" + row.id
+ "\" title=\"Remove\">",
"<i class=\"glyphicon glyphicon-trash\"></i>",
"</a>"
].join("");
2018-08-28 07:42:19 +00:00
}