Sapui5 如何获取最佳实践CRUD的POST数据(更新)
我们想更新/编辑客户的数据。因此,我们已经尝试了示例中的原始代码。该示例运行良好,但在将用户输入写入数据库之前,我们通常必须检查用户输入。这是我的密码:Sapui5 如何获取最佳实践CRUD的POST数据(更新),sapui5,hana,Sapui5,Hana,我们想更新/编辑客户的数据。因此,我们已经尝试了示例中的原始代码。该示例运行良好,但在将用户输入写入数据库之前,我们通常必须检查用户输入。这是我的密码: /** * Event handler (attached declaratively) for the view save button. Saves the changes added by the user. * @function * @public */ onSave: func
/**
* Event handler (attached declaratively) for the view save button. Saves the changes added by the user.
* @function
* @public
*/
onSave: function() {
var that = this,
oModel = this.getModel();
// abort if the model has not been changed
if (!oModel.hasPendingChanges()) {
MessageBox.information(
this._oResourceBundle.getText("keine Änderungen"), {
id: "noChangesInfoMessageBox",
styleClass: that.getOwnerComponent().getContentDensityClass()
}
);
return;
}
this.getModel("appView").setProperty("/busy", true);
if (this._oViewModel.getProperty("/mode") === "edit") {
// attach to the request completed event of the batch
oModel.attachEventOnce("batchRequestCompleted", function(oEvent) {
var oParams = oEvent.getParameters();
if (oParams.success) {
that._fnUpdateSuccess();
} else {
that._fnEntityCreationFailed();
}
});
}
oModel.submitChanges();
},
我如何访问请求数据?我试着查看oModel DOM,但只找到了一个包含大量无用内容的索引。甚至window.location.search
都不是解决方案。我们已经解决了
只需使用this.\u getFormFields(this.byId(“newEntitySimpleForm”)代码>尽管您已经回答了您的问题。。在将数据上载到后端之前,是否需要对其进行清理/验证?是的,我们需要在上载之前对其进行清理。我们已经找到了一个很好的类来这样做: