数据绑定到控制器函数返回

时间:2016-09-01 12:42:41

标签: sapui5

有没有办法将视图属性绑定到控制器函数的返回?

这样的事情:



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) {
	return Controller.extend("pelissari.soficom.launchpad.controller.TileGroup", {
		isEditable:function(){
			var ol_ListaTiles = this.getView().byId("tileList");
			return ol_ListaTiles.getEditable(true);
		}
	})
});

<OverflowToolbarButton text="teste" icon="sap-icon://delete" valueLiveUpdate="true" visible="isEditable"/>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

您可以根据需要操纵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(&#34; /测试&#34;,TRUE);