- 注册时间
- 2016-8-12
- 最后登录
- 1970-1-1
- 阅读权限
- 10
- 积分
- 174
- 精华
- 0
- 帖子
- 23
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>弹出选择面板 - 选择负责人</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /><link href="../demo.css" rel="stylesheet" type="text/css" />
<script src="../../scripts/boot.js" type="text/javascript"></script>
<style type="text/css">
.New_Button, .Edit_Button, .Delete_Button, .Update_Button, .Cancel_Button
{
font-size:11px;color:#1B3F91;font-family:Verdana;
margin-right:5px;
}
</style>
<script src="../CommonLibs/UserSelectWindow.js" type="text/javascript"></script>
</head>
<body>
<h1>弹出选择面板 - 选择负责人</h1>
<input type="button" value="保存" />
<div id="datagrid1" class="mini-datagrid" style="width:600px;height:280px;" allowResize="true"
url="../data/AjaxService.aspx?method=GetDepartments" idField="id"
allowCellEdit="true" allowCellSelect="true"
>
<div property="columns">
<div field="id" width="60" headerAlign="center" align="center">ID</div>
<div field="name" width="120" headerAlign="left" >部门名称</div>
<div field="manager" displayField="manager_name" name="manager" width="120" headerAlign="left" >负责人
<input property="editor" class="mini-buttonedit" style="width:100%;"/>
</div>
</div>
</div>
<script type="text/javascript">
mini.parse();
var grid = mini.get("datagrid1");
grid.load();
//-----------------------------------------
function saveData(row_uid) {
var rowsData = grid.getChanges();
grid.loading("保存中,请稍后......");
var json = mini.encode(rowsData);
$.ajax({
url: "../data/AjaxService.aspx?method=SaveDepartment",
data: { departments: json },
success: function (text) {
grid.reload();
},
error: function (jqXHR, textStatus, errorThrown) {
alert(jqXHR.responseText);
}
});
}
/////////////////////////////////////////////
var win = null;
function onButtonEdit(e) {
var buttonEdit = e.sender;
if (!win) {
win = new UserSelectWindow();
win.set({
url: bootPATH + "../demo/data/AjaxService.aspx?method=SearchEmployees",
title: "用户选择",
width: 600,
height: 350
});
}
win.show();
win.search();
//初始化数据
win.setData(null, function (action) {
if (action == "ok") {
//获取数据
var data = win.getData();
if (data) {
var row = grid.getSelected();
grid.updateRow(row, {
manager: data.id,
manager_name: data.name,
name:data.name
});
}
}
});
}
</script>
</body>
</html>
-----------------------------------------------------
grid.updateRow(row, {
manager: data.id,
manager_name: data.name,
name:data.name
});
这一段除了用update还有没有什么其他的方法?这个name:data.name;设置allowCellEdit="true"为false,再用grid.beginEditRow(),开启行编辑,用update方法后编辑就失效了,有什么解决办法?
|
|