- 注册时间
- 2014-6-5
- 最后登录
- 2015-7-17
- 阅读权限
- 10
- 积分
- 200
- 精华
- 0
- 帖子
- 59
|
felt 发表于 2014-6-9 14:54
var s = ' Edit'
这里拼接的点击方法,你要不同的表格不同的方法就拼不一样的方法啊 ...
我是这个效果。但现在是多个tab 走一个update 给你看下我的代码
<script type="text/javascript">
mini.parse();
//沥青路面
var LQdatagrid = mini.get("LQdatagrid");
//水泥路面
var SNdatagrid = mini.get("SNdatagrid");
//路基
var YXSSdatagrid = mini.get("YXSSdatagrid");
//构造物
var GZWdatagrid = mini.get("GZWdatagrid");
//沿线设施
var YXSSdatagrid = mini.get("YXSSdatagrid");
LQdatagrid.load(); SNdatagrid.load(); YXSSdatagrid.load(); GZWdatagrid.load(); YXSSdatagrid.load();
function onActionRenderer(e) {
var LQdatagrid = e.sender;
var SNdatagrid = e.sender;
var record = e.record;
var uid = record._uid;
var rowIndex = e.rowIndex;
//编辑行操作
var s = ' <a class="Edit_Button" href="javascript:editRow(\'' + uid + '\')" >Edit</a>'
if (LQdatagrid.isEditingRow(record)) {
s = '<a class="Update_Button" href="javascript:updateRow(\'' + uid + '\')">Update</a>'
} if(SNdatagrid.isEditingRow(record)){
s = '<a class="Update_Button" href="javascript:update(\'' + uid + '\')">123</a>'
}
return s;
}
function editRow(row_uid) {
var LQrow = LQdatagrid.getRowByUID(row_uid);
var SNrow = SNdatagrid.getRowByUID(row_uid);
if (LQrow||SNrow) {
//
LQdatagrid.cancelEdit();
LQdatagrid.beginEditRow(LQrow);
//
SNdatagrid.cancelEdit();
SNdatagrid.beginEditRow(SNrow);
}
}
function updateRow(row_uid) {
var row = LQdatagrid.getRowByUID(row_uid);
LQdatagrid.commitEdit();
var rowData = LQdatagrid.getChanges();
//LQdatagrid.loading("保存中,请稍后......");
var json = mini.encode(rowData);
alert(json);
$.ajax({
url: "../data/AjaxService.aspx?method=SaveEmployees",
data: { data: json },
success: function (text) {
LQdatagrid.reload();
},
error: function (jqXHR, textStatus, errorThrown) {
alert(jqXHR.responseText);
}
});
}
//==============================
function update(row_uid) {
var row = SNdatagrid.getRowByUID(row_uid);
SNdatagrid.commitEdit();
var rowData = SNdatagrid.getChanges();
//LQdatagrid.loading("保存中,请稍后......");
var json = mini.encode(rowData);
alert(json);
$.ajax({
url: "../data/AjaxService.aspx?method=SaveEmployees",
data: { data: json },
success: function (text) {
SNdatagrid.reload();
},
error: function (jqXHR, textStatus, errorThrown) {
alert(jqXHR.responseText);
}
});
}
</script>
|
|