1
我有一個自定義控件,它在「詳細視圖」頁面中插入了多個屬性。我用這些屬性綁定了數據。情景是我有兩個頁面,一個是列表視圖,然後是詳細視圖。我需要從詳細信息頁導航並從主頁選擇差異產品。詳細查看頁面根據選定的產品顯示差異產品詳細信息。一切正常。但問題是我的自定義控件不更新值,其他頁面有更新的值。更新模型時刷新sapui5中的自定義控件
<custom:product topic="" subTopic="{product>name}" id="productDetial"></custom:product>
我用一個methond this.getView().byId("productDetail").rerender();
但它不更新控制我內心的HTML。
控制碼。可能是一些拼寫錯誤。因爲我更改了一些變量名稱並刪除了不需要的代碼。目的是爲了表明我已經使用的方法,我怎麼沒
sap.ui.define([
"sap/m/Label",
"sap/m/Button",
"sap/m/CustomTile"
], function(Label, Button, CustomTile) {
"use strict";
jQuery.sap.declare("testProduct.control.product");
return CustomTile.extend("testProduct.control.product", {
metadata: { // the Control API
properties: {
name: {
type: "string",
defaultValue: "--"
},
subTopic: {
type: "string",
defaultValue: "--"
}
}
},
init: function() {
},
rerender: function(oRM, oControl) {
},
renderer: function(oRM, oControl) {
oRM.write('<div class=" sapMTile customTileCourseDetail">');
oRM.write('<div class="leftTileYourScore">');
if (oControl.getSubTopic() !== "" && oControl.getSubTopic() !== undefined) {
oRM.write(oControl.getSubTopic());
} else {
oRM.write(" ");
}
oRM.write('</div>');
oRM.write('</div>
}
});
});
您將有機會分享特定的自定義控制更多的代碼,找出問題 –
你有沒有嘗試刷新模式,而不是控制,比如'this.getView()。getModel()。刷新(TURE );'?參數'true'強制刷新使用正在刷新的模型的控件。 – keshet
是的,我試過了。即使當我使用控制檯數據它給了我更新的記錄。但在頁面上顯示仍然是前一個 – afaq