Skip to Content
avatar image
Former Member

Capture Row Data in sap.m.Table upon clicking button in the sap.m.ColumnListItem

Hello UI5 experts,

How can I capture the complete row data upon click of the Edit button in the last column. I have found similar issue in other threads and tried below, but not able to capture the row data.

var oItem = oEvent.getSource().getParent();
var iIndex = oEvent.getSource().getParent().getParent().indexOfItem(oItem);
	    
var sFirst = '/';
var sPath  = sFirst.concat( iIndex );	    
	    	    
var oTable = sap.ui.getCore().byId("idChangeTable1");
var model = oTable.getModel();
var obj = model.getObject(sPath); // This statement is not returning any values to me

capture.jpg

capture.jpg (38.3 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Jul 07, 2017 at 07:36 AM

    HI

    Here is an example.

    http://jsbin.com/pulenom/edit?js,output

    Please do not attempt the traversal the hierarchy to get the value.

    Thanks

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 06, 2017 at 08:01 PM

    Hi Mohammad,

    Please try the below one:

    var getTabledata = that.getModel("Items").getData().results;
    var itemPosition = oEvent.getSource().getParent().getParent().indexOfItem(oEvent.getSource().getParent())
    Once you get the item position, you can get the data of the complete row from below
    var selctedRowdata = getTabledata[itemPostion]; // this has the complete row info
    

    Regards

    Madhu

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 07, 2017 at 07:56 AM

    Thanks Dennis, your solution worked for me..

    var oContext = oEvent.getSource().getBindingContext();
    var oObject = oContext.getObject();

    Thanks once again..

    Add comment
    10|10000 characters needed characters exceeded