Jquery UI中对话框的空标题
empty title of dialog in Jquery UI
我写了这个脚本,用户选中要删除的复选框信息,然后单击删除按钮,它用ajax删除信息。我的问题是,当我第一次删除时,一切都很好,但在第二次对话框的标题是空的。为什么?
我在显示对话框后使用此代码,因为我的标题是动态的:
$("#ui-id-1").text(tittle)
<script src="../../Scripts/jquery-1.8.3.js"></script>
<script src="../../Scripts/jquery-ui-1.9.2.custom.js"></script>
<script>
$(function () {
$(":checkbox").change(function () {
var $this = $(this);
if ($this.is(":checked")) {
$this.closest("tr").addClass("SlectedtRow");
} else {
$this.closest("tr").removeClass("SlectedtRow");
}
})
var tittle = '';
var url = '';
$("#dialog").dialog({
autoOpen: false,
width: 400,
modal: true,
resizable: false,
buttons: [
{
text: "بلی",
click: function () {
Delete();
$(this).dialog("close");
}
},
{
text: "خیر",
click: function () {
$(this).dialog("close");
}
}
]
});
var IsActive
// Link to open the dialog
$(".insertBtn").click(function (event) {
var IsSelected = false;
var ModalText = " آیا کاربر ";
$('#userForm input:checked').each(function () {
ModalText += this.value + " - "
IsSelected = true;
});
if (IsSelected) {
document.getElementById('ErrorContent').style.display = "none";
ModalText = ModalText.slice(0, -2);
if (this.id == 'DeleteUser') {
ModalText += " حذف گردد "
tittle = 'حذف کاربر'
url = '@Url.Action("DeleteUser", "UserManagement")';
}
else if (this.id == 'InActiveUser') {
ModalText += " غیر فعال گردد "
tittle = 'تغییر فعالیت کاربر '
url = '@Url.Action("ChangeActiveStatus", "UserManagement")';
IsActive = false;
}
else if (this.id == 'ActiveUser') {
ModalText += " فعال گردد "
tittle = 'تغییر فعالیت کاربر '
url = '@Url.Action("ChangeActiveStatus", "UserManagement")';
IsActive = true;
}
$('#ModalMessgae').text(ModalText);
$("#dialog").dialog("open");
$("#ui-id-1").text(tittle);
event.preventDefault();
} })
function Delete() {
var list = [];
$('#userForm input:checked').each(function () {
list.push(this.id);
});
var parameters = {};
if (url == '@Url.Action("DeleteUser", "UserManagement")') {
parameters = JSON.stringify(list);
}
else {
parameters = JSON.stringify({ "userId": list, "ISActive": IsActive });
}
$.ajax({
url: url,
type: 'POST',
contentType: 'application/json; charset=utf-8',
dataType: "html",
traditional: true,
data: parameters,
success: function (data, textStatus, jqXHR) {
$('#updateAjax').html(data);
},
error: function (data) {
$('#updateAjax').html(data);
}
}); //end ajax
}
});
</script>
html标记
@using Common.UsersManagement.Entities;
@model IEnumerable<VwUser>
@{
Layout = "~/Views/Shared/Master.cshtml";
}
<form id="userForm">
<div id="updateAjax">
@if (string.IsNullOrWhiteSpace(ViewBag.MessageResult) == false)
{
<div class="@ViewBag.cssClass">
@Html.Label(ViewBag.MessageResult as string)
</div>
<br />
}
<table class="table" cellspacing="0">
@foreach (VwUser Item in Model)
{
<tr class="@(Item.IsActive ? "tRow" : "Disable-tRow")">
<td class="tbody">
<input type="checkbox" id="@Item.Id" name="selected" value="@Item.FullName"/></td>
<td class="tbody">@Item.FullName</td>
<td class="tbody">@Item.Post</td>
<td class="tbody">@Item.Education</td>
</tr>
}
</table>
</div>
<br />
<br />
@if (!Request.IsAjaxRequest())
{
<div class="btnContainer">
<a href="#" id="DeleteUser" class="insertBtn">delete </a>
<br />
<br />
</div>}
设置标题如下
指定对话框的标题。如果该值为null,则将使用对话框源元素上的title属性。
代码示例:
使用指定的标题选项初始化对话框:
$( ".selector" ).dialog({ title: "Dialog Title" });
//Get or set the title option, after initialization:
// getter
var title = $( ".selector" ).dialog( "option", "title" );
// setter
$( ".selector" ).dialog( "option", "title", "Dialog Title" );
请参阅对话框中的设置标题
相关文章:
- CKEditor v4:自制插件中对话框的动态标题
- 如何在jQuery对话框标题栏中添加额外的按钮
- Jquery UI中对话框的空标题
- 如何打开jQuery对话框并将其标题自动设置为HTML标记中的属性
- 设置 Jquery 对话框标题栏样式
- 将动态OG标题,描述和图像传递到javascript中的Facebook共享对话框
- 更改 jquery UI 对话框标题栏 HTML
- 是否可以从远程文件更改引导对话框标题和其他属性
- 没有标题栏的jQuery UI对话框,但保留关闭按钮
- 如何在一次函数调用中组合 jQuery UI 对话框标题更改和打开
- 在 iOS 中更改 JavaScript 警报对话框标题
- 使用 jQuery 更新对话框标题
- 无法从对话框中更改标题
- 在对话框的标题栏中添加图像
- 将文本与对话框中标题栏中的图像对齐
- 在jQuery对话框中添加一个函数以关闭标题-事件未启动
- “警报”对话框中的标题
- 在对话框标题栏中的“关闭”按钮旁边添加按钮
- 对话框中的多行标题
- 增加标题栏和其他元素'宽度以覆盖整个JQuery对话框