cancel
Showing results for 
Search instead for 
Did you mean: 

How can Formatter access function in parent class

01-23-2020 5:47 AM
1024 views 6 comments
0 Likes
SAP Managed Tags
Subscribe

Hi,

I have a requirement to format date. For this I have written function in the parent class. Now how can I access parent function in the formatter ?

This is what I am trying but without success. This is piece of code of my Excel Export.

{
name: "Level1 Timestamp",
template: {
  content: "{path: 'Level1Timestamp', formatter: 'BaseController.datTimeFormat'}"
}

BaseController (the file name and also the instance of parent class is BaseController) is the parent controller which has dateTimeFormat function.

I tried full path of Parent class but no luck. Both Parent class and the child class (where I am using formatter) are in the same View folder.

0 Likes

Accepted Solutions (0)

Answers (2)

Answers (2)

mariusobert
Developer Advocate
Developer Advocate
0 Likes

I'm not sure if there's a way to do this with the "string annotation". Worst case, you can write a delegate function in your controller.

datTimeFormat: function(){
  this.prototype.datTimeFormat.apply(this, arguments);
}
Former Member
0 Likes

I think there is way ....because, if I try to use another formatter function (which is in the util folder of my project with format file name) giving the absolute path (Application root followed by util folder and format file name) then it works.

But same if I try (I mean path) for my BaseController then it doesn't work. So looks like I am not following the correct syntax while providing the BaseController.js path.

Joseph_BERTHE1
Active Contributor
0 Likes

Hello,

Did you simply try this :

formatter: '.datTimeFormat'

With the dot and then without the dot.

Regards,

Joseph

Former Member
0 Likes

Yep..neither of them worked.