代码
var editGridPanel = new Ext.grid.EditorGridPanel({
cm: cm,
store: store,
autoScroll: true,
frame: true,
region: 'center',
clicksToEdit: 1,
tbar:[
comboTerm, comboExamName
],
listeners: {
"afteredit": function(e) {
var r = e.record; //得到当前行所有数据
var f = e.field; //得到修改列
var v = e.value; //得到修改列修改后值
if (v == "") {
editGridPanel.getStore().reload();
return;
}
//通过ajax请求修改数据
Ext.Ajax.request({
url: "StuScoreAjax.ashx?model=update",
method: "POST",
params: {
FieldName: f,
UpdateValue: v,
ID: r.data.ID
},
success: function(r) {
editGridPanel.getStore().reload();
},
failure: function() {
MessageBox("提示", "操作失败!", Ext.MessageBox.ERROR);
editGridPanel.getStore().reload();
}
});
}
}
});
cm: cm,
store: store,
autoScroll: true,
frame: true,
region: 'center',
clicksToEdit: 1,
tbar:[
comboTerm, comboExamName
],
listeners: {
"afteredit": function(e) {
var r = e.record; //得到当前行所有数据
var f = e.field; //得到修改列
var v = e.value; //得到修改列修改后值
if (v == "") {
editGridPanel.getStore().reload();
return;
}
//通过ajax请求修改数据
Ext.Ajax.request({
url: "StuScoreAjax.ashx?model=update",
method: "POST",
params: {
FieldName: f,
UpdateValue: v,
ID: r.data.ID
},
success: function(r) {
editGridPanel.getStore().reload();
},
failure: function() {
MessageBox("提示", "操作失败!", Ext.MessageBox.ERROR);
editGridPanel.getStore().reload();
}
});
}
}
});