2014-09-11 36 views
-1

如何在點擊按鈕時隱藏/顯示錶格列。SAP UI 5表列

例如Check Here

我需要在點擊外部按鈕時隱藏/顯示價格列。

+1

單擊按鈕將列可見性設置爲false。 – Saddamhussain 2014-09-11 12:50:52

+0

顯示你已經嘗試過的代碼。 – qmacro 2014-09-11 15:15:42

回答

0

是如下,我們可以訪問表列,然後設置屬性。

var tab= this.getView().byId("idProductsTable"); 
col=tab.getColumns()[5]; 
tab.getColumns()[5].setProperty("visible",false); 
0
var oTable = new sap.ui.table.Table(); 

     var oProduct=new sap.ui.table.Column({ 
      label: new sap.ui.commons.Label({text: "Product"}), 
      template: new sap.ui.commons.TextView({ 
       text:"TExt" 
      }) 
     }); 

     var oPrice=new sap.ui.table.Column({ 
      label: new sap.ui.commons.Label({text: "Price"}), 
      template: new sap.ui.commons.TextView({ 
       text:"price" 
      }) 
     }); 
     oTable.addColumn(oProduct); 
     oTable.addColumn(oPrice); 

     //Button 

     var oButton = new sap.ui.commons.Button({text:"Button", 
      press:function(){ 
       oPrice.setVisible(false); 
      } 
     }); 

這必將有助於