2016-07-13 30 views

回答

3

隨着indexOfRow你會得到該行的索引在其中放置點擊按鈕。

據我所知,沒有必要找出列的索引,因爲它對每個按鈕都是一樣的。

Here是演示。

2

//查看

<Table cellClick="onPress"></Table> 

//控制器

onPress : function(oEvent) { 
     this.showObject(oEvent.getParameters()); 
}, 

showObject : function(oParameters) { 
    yourTableObject = ..... 2 do 
    var rowIndex = oParameters.rowIndex; 
    var colIndex = oParameters.columnIndex; 
    var sPath = yourTableObject.getContextByIndex(rowIndex).sPath; 
    var oDataSelect = yourTableObject.getContextByIndex(rowIndex).oModel.getProperty(sPath); 

} 

如果你想克利克的圖標將是

onPressYourIcon : function(oEvent) { 
    var oItem = oEvent.getSource(); // <-- this is what you Need, the clicked item 
    var sPath = oItem.getBindingContext().sPath; 
} 
+0

感謝您的答覆,但它可以在你點擊單元格的任何地方工作,但我需要點擊特定的圖標只有...等圖標點擊我們可以做一些類似的事情 –

+0

我添加了項目點擊:)然後你必須找出哪個圖標它是通過Id或以某種方式通過綁定上下文,你不能找出「在哪個行/列我的桌子是這個圖標「 – zyrex