我需要点击修改按钮时,将我当前选中行的数据对应的赋值给dialog弹出的修改窗口,看一下代码吧
{
text: '修改',
iconCls: 'icon-edit',
handler: function () {
var row = $('#tab').datagrid('getSelected');
if (row == null)
{
$.messager.alert("系统提示", "请选择您要修改的数据!");
return;
}
if (row)
{
$("#txtLoginId").val(row.LoginId);
$("#txtLoginPwd").val(row.LoginPwd);
$("#txtUserStateId").val(row.UserStateId);
$("#txtTeacherName").val(row.TeacherName);
$('#txtSex').val(row.Sex);
$('#txtBirthday').val(row.Birthday.datebox('getValue'));
}
$("#divadd").show();
$("#divadd").dialog({
title: '修改',
width: 300,
height: 300,
closed: false,
cache: false,
modal: true,
buttons: [{
text: '保存',
iconCls: 'icon-save',
handler: function () {
var teacherid = row.teacherid;
var loginid = $("#txtLoginId").val();
var LoginPwd = $("#txtLoginPwd").val();
var UserStateId = $("#txtUserStateId").val();
var TeacherName = $("#txtTeacherName").val();
var Sex = $('#txtSex').datebox('getValue');
var Birthday = $('#txtBirthday').datebox('getValue');
$.ajax({
type:"post",
url: "Handler.ashx?type=2&TeacherId="+teacherid+"&loginId=" + loginid + "&LoginPwd=" + LoginPwd + "&UserStateId=" + UserStateId + "&TeacherName=" + TeacherName + "&Sex=" + Sex + "&Birthday=" + Birthday,
success: function (data) {
if (data == "ok") {
$.messager.alert("系统提示", "数据修改成功!");
showDate();
$('#divadd').dialog('close');
}
else {
$.messager.alert("系统提示", "数据修改失败!");
return false;
}
}
})
}
}, {
text: '关闭',
iconCls: 'icon-cut',
handler: function () {
$('#divadd').dialog('close');
$("input").val('');
}
}]
})
}
没有赋值成功,求赐教!