我在数据表中有一个按钮,用于打开模态。模态在数据表的外部运行良好,仅在内部。这是我的桌子”
value = $("#disaster_Id").val();
var tableDamageArea = $("#DamagedAreatable").DataTable({
columnDefs: [{
className: "dt-center", "targets": "_all"
}],
ajax: {
url: "/api/disaster/GetDamagedAreaByDisasterId",
data: { DisasterId: value },
dataSrc: ""
},
columns: [
//{
// data: "Id",
// render: function (data) {
// return "<button id='btnEditArea' class='js-view btnInsideTable' data-area-id= '" + data + "'>Edit</button>";
// }
//},
{
data: "Area"
},
{
data: "CompletePercent"
},
{
data: "Id",
render: function (data) {
debugger;
return "<a data-target='#custom-modal-Area-Image' data-toggle='modal' data-animation='fadein' data-plugin='custommodal' data-overlaySpeed='200' data-overlayColor='#36404a' class='js-viewImage btn btn-custom waves-effect waves-light' data-area-id= " + data + ">Images</a>"
}
},
{
data: {
Id: "Id",
DisasterId: "DisasterId"
},
render: function (data) {
return "<a href='/Disaster/PrintArea/" + data.Id + "?DisasterId=" + data.DisasterId + "'>Print Document</a>";
}
},
{
data: "Id",
render: function (data) {
return "<button id='btnEditArea' style='padding-top:0px; padding-bottom: 0px' class='js-delete btn btn-custom waves-effect waves-light' data-customer-id=" + data + ">Delete</button>";
}
}
]
});
$(document).ready(function () {
$("#DamagedAreatable").on("click", ".js-viewImage", function () {
debugger;
$('#custom-modal-Area-Image').show();
});
});
该Modal来自一个bootstrap模板,所以就像我说的那样,它在datatable按钮外部可以正常工作。这是我的模态:
<div id="custom-modal-Area-Image" class="modal-demo">
<button type="button" class="close" onclick="Custombox.modal.close();">
<span>×</span><span class="sr-only">Close</span>
</button>
<h4 class="custom-modal-title">Area Images</h4>
<div class="custom-modal-text text-left">
@using (Html.BeginForm("AddImages", "Disaster", FormMethod.Post, new { id = "ImagesAreaform", enctype = "multipart/form-data" }))
{
<div style="text-align: center">
<div style="text-align: center">
<input id="FileAttachment1" name="FileAttachment1" type="file" multiple style="width: 100%; margin: auto;" class="dropZone" />
</div>
<div class="btn_Div">
<button class="btn btn-custom waves-effect waves-light m-b-20" id="btnUploadImage">Upload Images</button>
</div>
</div>
<input id="selectedAreaId" type="hidden" name="AreaID" />
@Html.HiddenFor(m => m.disaster.Id, new { @id = "disaster_Id", @name = "disaster_Id" })
@Html.TextBoxFor(m => m.damageArea.Id, new { @id = "damageArea_Id", @name = "damageArea_Id" })
@Html.AntiForgeryToken()
}
<div style="padding-top: 10px; width: 100%">
<table id="AreaImgs" style="width: 100%;" class="table table-striped table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Uploaded Date</th>
<th>Delete</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
背景在前面,我什至不能触摸任何东西。这就是我所得到的,“区域图像”应该是我的模态,并且全部位于html上的底部,但应该位于中央。请帮忙 https://i.stack.imgur.com/mBZA1.png