2014-02-25 292 views
1

我想实现使用SAPUI5表中的行选择时,我写了下面的代码:AttachRowSelect功能不能正常工作SAPUI5

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); 
     }); 

当我执行的代码,我在浏览器"Uncaught TypeError: Object [object Object] has no method 'attachRowSelect'"得到一个错误。任何想法的问题是。对于我来说,在提到'http://scn.sap.com/thread/3452412'和'http://scn.sap.com/community/developer-center/front-end/blog/2012/06/01/sample-application-using-ui5-and-gateway'后应该可以正常工作。

由于

回答

2

attachRowSelect属于弃用数据表控制的方法。

从你的代码,我理解你正在使用的表控制,它有一个方法attachRowSelectionChange

+1

PERFEKT。我会做的第一件事是先读并阅读文档。非常感谢 :) –