How to pass control reference to formatter in XMLView?

前端 未结 3 1941
执念已碎
执念已碎 2020-12-17 07:25

In SAPUI5\'s JSView, it is quite easy to pass the current control reference to a formatter function:

oTable.bindItems(         


        
3条回答
  •  悲&欢浪女
    2020-12-17 07:50

    Define your formatter functions in a separate file. Then this will be the Control whose property is being formatted.

    my/own/Formatter.js:

    sap.ui.define(function () {
        "use strict";
        return {
            formatCell: function (iValue) {
                var idText = this.getId(); //this references the current control
                return iValue;
            }
        };
    });
    

    View:

    
            
                
            
        
            
                
                    
                
            
        

提交回复
热议问题