Question

I am trying to implement the row select event on a table using SAPUI5 and I write the below code:

var oModel = new sap.ui.model.odata.ODataModel( "../path.xsodata",true);
sap.ui.getCore().setModel(oModel);
oTable.bindRows({path:"/path", formatter:function(fValue) {   
        jQuery.sap.require("sap.ui.core.format.DateFormat");  
        var oDateFormat = sap.ui.core.format.DateFormat.getDateTimeInstance({pattern: "dd.MM.yy"});   
        return oDateFormat.format(new Date(fValue));    
        } }).placeAt("table");

oTable.attachRowSelect(function(oEvent){
        var currentRowContext = oEvent.getParameter("rowContext"); 
        var first_value= oSystemDetailsML.getProperty("firstvalue", currentRowContext);
        //var second_value= oSystemDetailsML.getProperty("secondvalue", currentRowContext);
        });

When I execute the code I get an error in the browser "Uncaught TypeError: Object [object Object] has no method 'attachRowSelect'". Any ideas where the problem is. For me it should work fine after referring ´http://scn.sap.com/thread/3452412´ and ´http://scn.sap.com/community/developer-center/front-end/blog/2012/06/01/sample-application-using-ui5-and-gateway´.

Thanks

Was it helpful?

Solution

The method attachRowSelect belongs to the deprecated DataTable control.

From your code I understand you're using the Table control, which has a method attachRowSelectionChange

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top