单元格编辑 级联刷新
PDERPDB db = new PDERPDB();
int conid = 0;
int pid = 0;string sql = "";
string sqlC = "";if (int.TryParse(Pid, out pid))
{ sql = string.Format(@" UPDATE JL_Project set PCMoney={0} where Pid={1};", pcmoney, Pid); }if (sql.Length > 0)
{ db.ExecuteCommand(sql); }if (int.TryParse(Conid, out conid))
{ decimal? sum = ((from row in db.JL_Project where row.Conid == conid select row.PCMoney).Sum()); if (sum.HasValue) { sqlC = string.Format(@" UPDATE JL_Contract set Cmoney={0} where Conid={1}", sum.Value, conid); txtcmoney.Text = sum.Value.ToString(); } else { sqlC = string.Format(@" UPDATE JL_Contract set Cmoney=0 where Conid={0}",conid); txtcmoney.Text = "0"; } } if (sqlC.Length > 0) { db.ExecuteCommand(sqlC); }
页面上 js
var gridPCBeforeEdit = function (e) { return true; }var gridPCAfterEdit = function (e) {
var row = gridProject.getSelectionModel().getSelected();
var ProjectID = e.record.data.Pid; var Conid = e.record.data.Conid; var value = e.value;SCM.DoSaveProCon(hidPCID.getValue(), ProjectID, value,
{ success: function (result) { e.record.commit(); storeTPJ.reload(); AfterSave(); }, failure: function (result) { Ext.Msg.alert('系统提示', '数据更新失败!' + result); e.record.reject(false); } }); }