简体   繁体   中英

how to set visibility of div in controller (SAP UI5)

I have designed a SAP UI5 Application

I have a div which contains highcharts.

<html:div id="Tab2Chart" class="sapUiSmallMarginBegin sapUiSmallMarginTop" 
   style="width:45%;float:left;height:auto"></html:div>

Now, A button is present in View. On clicking it, above div should hide ie highchart should not be visible. How to achieve this. i am able to get div in controller by using-

 var _ID2= this.getView().byId("Tab2Chart").getId();

After this, suggest me solution.

Adding the answer to this here:

You can always refer any items through their ids as: this.getView().byId("idOfIntentedElement")

  • Refer the view : this.getView()

  • Refer element in the views by their ids : this.getView().byId("id")

 this.getView().byId("Tab2Chart").setVisible(false); 

You can use the standard setVisible method or jQuery hide method commented below.

var _ID2= this.getView().byId("Tab2Chart").getId();
this.getView().byId("Tab2Chart").setVisible(false);
// $('#'+_ID2).hide();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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