我有一个主从页面。在详细信息页面上进行了一些事务(编辑一些数据)之后,我想将刷新后的数据留在“主”列表中。但是在编辑和刷新模型之后,页面导航到“主列表”的第一项,而不是停留在主列表及其详细信息页面的同一项上。下面是编辑数据后的代码:
Detail.controller.js:
update: function (evt) {
that.oDataModel.update("/RaiseQuerySet('" + that.detailModel.getData().EICNO + "')",
this.data, null, function (data) {
MessageBox.success("Your query has been updated", {
onClose: function (sAction) {
that.cancelIndent();
that.refreshPage();
}
});
}
refreshPage: function () {
var that = this;
$.ajax({
url: "/sap/opu/odata/sap/ZHR_V_CARE_SRV/EmpQueryInitSet('10002001')?$expand=QueryLoginToQueryList/QueryToLog",
method: "GET",
dataType: "json",
success: function (data) {
that.getView().getModel("totalModel").setData(data.d.QueryLoginToQueryList);
that.router.navTo('DetailPage', {
QueryNo: that.detailModel.getData().EICNO
});
//
that.totalModel.refresh(true);
that.detailModel.refresh(true);
}
});
},
cancelIndent: function (evt) {
this.detailModel.refresh(true);
}
DetailModel用于填充详细信息页面中的数据,totalModel用于填充母版页面中的数据。
如果在manifest.json文件中您有两个与路由DetailPage链接的目标,则可能发生。
根据您所解释的行为,我会说是这种情况。
WebIDE的主细节模板通常在ListSelector.js文件中具有逻辑,每次显示主列表时,该逻辑都会自动选择第一项。