【发布时间】:2010-12-13 21:41:05
【问题描述】:
我需要保存一些数据并返回在 SQL 2005 数据库中创建的 ID。我需要在保存之前将 ID 传递给另一个对象,以便正确关联它们。
使用 Ext 完成此任务的最佳方法是什么?框架中是否有任何内置功能使这变得简单?
谢谢。
function AddPromotionType() {
var currentDate = new Date();
var newTypeJsonObject = {
promotionTypeId: '0',
promotionType: Ext.getCmp('txtPromoType').getValue(),
updatedBy: userid,
updateDate: currentDate
}
// serialize our service object
var newLevelJsonData = Ext.encode(newTypeJsonObject);
// call the web service and pass over our service object
Ext.lib.Ajax.defaultPostHeader = 'application/json';
Ext.Ajax.request({
url: 'Service/AddPromoType',
method: 'POST',
params: newLevelJsonData,
success: function(response, options) {
AddTypeWindow.destroy();
AddTypeWindow.hide();
// refresh dropdown to reflect new data
Ext.getCmp('newPromoType').getStore().reload();
},
// if data fails to save, show message
failure: function(response, options) {
Ext.MessageBox.alert('Error saving new promotion type', response.responseText);
}
});
}
【问题讨论】:
标签: javascript asp.net wcf extjs