cancel
Showing results for 
Search instead for 
Did you mean: 

How can Formatter access function in parent class

former_member243729
Participant
0 Kudos
307

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.

Accepted Solutions (0)

Answers (2)

Answers (2)

mariusobert
Developer Advocate
Developer Advocate
0 Kudos

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_member243729
Participant
0 Kudos

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_BERTHE
Active Contributor
0 Kudos

Hello,

Did you simply try this :

formatter: '.datTimeFormat'

With the dot and then without the dot.

Regards,

Joseph

former_member243729
Participant
0 Kudos

Yep..neither of them worked.