基本上,我需要建立一个可点击的行,可以点击行,然后显示用户细节。 然而,当单点冻结 but子在tag子内时,细节模式也随之消失。 我不想这样说,因为我只想看到冻结模式,而不是细节模式。 提前感谢。
Html Code:
<tr data-toggle="modal" data-id="1" data-target="#detailModal" class="row-click">
<td>
<span class="custom-checkbox">
<input type="checkbox" id="checkbox@(i)" name="options[]" value=@i>
<label for="checkbox@(i)"></label>
</span>
</td>
<td>@Model.UsersList[i].Username</td>
<td>@Model.UsersList[i].Email</td>
<td>@Model.UsersList[i].FirstName</td>
<td>@Model.UsersList[i].LastName</td>
@{
if (!Model.UsersList[i].IsDeleted)
{
<td style="color: #008000; font-weight: bold;">Active</td>
}
else
{
<td style="color: #FF0000; font-weight: bold;">Deleted</td>
}
}
<td class="actions-td">
<div class="dropdown">
<button type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="material-icons" data-toggle="tooltip" title="More"></i>
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item delete" href="#" data-target="#deleteUserModal" data-toggle="modal" data-userId="@Model.UsersList[i].UserId" data-username="@Model.UsersList[i].Username">Freeze</a>
<a class="dropdown-item" href="@Url.Action("CreateOrUpdateUser", "User", new { id = Model.UsersList[i].UserId })" >Edit</a>
<a class="dropdown-item" href="@Url.Action("CreateOrUpdateLicense", "FHUserLicenseProfile")">Add License</a>
</div>
</div>
</td>
</tr>
Jquery Code:
<script>
$(document).ready(function () {
$(".delete").click(function () {
var userId = $(this).data( userId );
var userName = $(this).data( username );
$("#userDataDelete").text("Username: " + userName);
$("#userIdDelete").val(userId);
$("#usernameDelete").val(userName);
});
});
$(function () {
$( #detailModal ).modal({
keyboard: true,
backdrop: "static",
show: false,
}).on( show , function () {
var getIdFromRow = $(event.target).closest( tr ).data( id );
});
});
</script>
我试图在删除 but子时躲避这一模式,但并非奏效。