问题
新开一个tab,操作一个dialog功能正常,确认和取消都正常,关闭tab,重新打开tab,操作dialog,确定和取消功能都不正常了.
代码
打开tab的代码
openTabs = function (path, title) {
if ($('#home').tabs('exists', title)) {
$('#home').tabs('select', title);
} else {
$('#home').tabs('add', {
title: title,
href: path,
closable: true
});
}
}
openTabs('/index.php/PhoneRec/store.html','电话');
打开dialog的代码
$("#PhoneRec_dialog").dialog({
title: '编辑',
width: 700,
height: 520,
resizable: true,
modal:true,
href: '/index.php/PhoneRec/edit/id/' + id,
buttons: [{
text: "修改",
iconCls: "icon-edit",
handler: function () {
if ($('#PhoneRec_edit').form('validate')) {
$.ajax({
url: '/index.php/PhoneRec/edit/id/' + id,
type: 'post',
data: {
Customer_Name: $("#PhoneRec_edit input[name='Customer_Name']").val(),
Phone_time: $("#PhoneRec_edit input#Phone_time").val(),
Copy_Contact: $("#PhoneRec_edit input#Copy_Contact").val(),
Tel: $("#PhoneRec_edit input#Tel").val(),
Phone_Content: $("#PhoneRec_edit textarea#Phone_Content").val(),
PreTail: $("#PhoneRec_edit input[name='PreTail']").val(),
Memo: $("#PhoneRec_edit textarea#Memo").val(),
Memo_old: $("#PhoneRec_edit textarea#Memo_old").val(),
Isgathering: $("#PhoneRec_edit input[name = 'Isgathering']").val(),
IsDail: $("#PhoneRec_edit input[name='IsDail']").val(),
},
beforeSend: function () {
$.messager.progress({
text: '正在修改电话记录。。。。'
})
},
success: function (data, response, status) {
$.messager.progress('close');
if (data == 1) {
$.messager.show({
title: '提示',
msg: '修改记录成功'
});
$("#PhoneRec_dialog").dialog('close');
$('#PhoneRec_data').datagrid('reload');
} else {
$.messager.alert('修改记录失败', data, 'warning');
}
}
})
}
}
}, {
text: "取消",
iconCls: "icon-redo",
handler: function () {
$("#PhoneRec_dialog").dialog("close");
$("#PhoneRec_edit").form("reset");
}
}]
})
感谢@kikong 的帮助,在他给出的测试代码中,我修改出符合我项目的代码
easyui_tab.html
Title
First Tab
Second Tab
Third Tab
edit.html
问题发现
在
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
查看下浏览器控制台是否有错误信息
我贴了个样例代码,看看和你的有哪些地方不一样的?