2014-09-11 32 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); 
      } 
     }); 

这必将有助于