Skip to Content
Author's profile photo Akshaya p

Add Static Values in Formatter in XMLView

We can add static values in a XML View by defining the static data in i18n properties file.

in i18n.properties file add the below line

Notifications=Notifications

In XML View add similar code like this:

count=”{parts:[‘NotificationCount’,’i18n>Notifications’],formatter:’.formatter.hideZeroCount’}”

 

Note: ‘NotificationCount’ comes from oData model and i18n>Notifications is the static text from i18n.

You could access both values in formatter as below

 

hideZeroCount:function(count,id) {

if(id==”Notifications”) {

if(count==0) {

return null;

} else {

return count;

}

}

},

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.