2016-09-01 44 views
0

有沒有辦法將視圖屬性綁定到控制器函數的返回?數據綁定到控制器函數返回

事情是這樣的:

sap.ui.define([ "sap/ui/core/mvc/Controller", 
 
       "sap/ui/model/Filter", 
 
       "sap/ui/model/FilterOperator", 
 
       "pelissari/soficom/launchpad/model/formatter", 
 
       "sap/ui/model/json/JSONModel"], 
 
       function(Controller, Filter, FilterOperator, formatter,JSONModel) { 
 
\t return Controller.extend("pelissari.soficom.launchpad.controller.TileGroup", { 
 
\t \t isEditable:function(){ 
 
\t \t \t var ol_ListaTiles = this.getView().byId("tileList"); 
 
\t \t \t return ol_ListaTiles.getEditable(true); 
 
\t \t } 
 
\t }) 
 
});
<OverflowToolbarButton text="teste" icon="sap-icon://delete" valueLiveUpdate="true" visible="isEditable"/>

回答

1

你可以操縱JSON對象,並更改根據您的需要的功能的知名度;

var testJSON = {test:false}; 
this.testModel = new JSONModel(); 
this.testModel.setData(testJSON); 
this.getView().byId('testLabel').setModel(this.testModel); 

綁定;

<Label id="testLabel" text="test" visible="{/test}"></Label> 

如果要更改值;

this.testModel.setProperty(「/ test」,true);

相關問題