简体   繁体   English

离开后重置视图-SAPUI5

[英]Reset View after leaving it - SAPUI5

I need to reset my Search-view on Button Click. 我需要在“按钮单击”上重置搜索视图。 That means when I leave the view through the "close"-Button and go back to the search, it is supposed to be reloaded: 这意味着当我通过“关闭”按钮离开视图并返回搜索时,应该重新加载它:

  • Inputs empty 输入为空
  • Result-table hidden 结果表已隐藏
  • as if it is reloaded 就像重新加载一样

I just cant make sure to reload the view because once it is called, its saved in the Core and cant be deleted, without being unable to get it again. 我只是不能确保重新加载视图,因为一旦调用它,它就保存在Core中并且不能删除,而又无法再次获得它。

Right now I am setting the Visibility to false and true to open or close the view, but I cant find the magic code here!^^ 现在,我将“可见性”设置为false和true,以打开或关闭视图,但在这里找不到魔术代码!^^

Here is what happens when I press the close Button: 当我按下关闭按钮时,会发生以下情况:

handleSchliessen : function () {
        var p = this.getView('suche');
        p.setVisible(false);
        sap.ui.getCore().byId("Handler").getModel("datenModel").refresh(true);
        this.callbackMethod.call(this.callbackObject);
    },

Any help would be great guys, I can provide more Code if you need, its just too long :) 任何帮助都是很棒的人,如果您需要,我可以提供更多代码,因为它太长了:)

My normal approach is to bind everything to a model (visibility result table, results, input fields) and set these model properties back to their initial state when done. 我的正常方法是将所有内容绑定到模型(可见性结果表,结果,输入字段),并在完成后将这些模型属性设置回其初始状态。

For instance, 例如,

var initState = {
    tblVisible : false,
    searchResults : [],
    input : ""
}

oModel.setProperty("/path/to/searchview/properties", initState);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM