sap - How can I format input field to a percentage value? -


using sapui5 xml view, add formatter onto input field. depending on user enters (digits) see trailing % attached value.

so if userinput value = "99" ---> "99%" or ".5" ---> "50%" 

looking @ datatypes, i'm not sure there 'out of box' solution format input value percentage. ideas how can accomplished?

 <input     id="percentgrowth"     type="text"     value="{path:'inputmodel>/mypath', type:'sap.ui.model.type.float', contraints: {maximum : 1}}"   > </input> 

you should use formatter formatter sapui5

for example

   <input     id="percentgrowth"     type="text"     value="{path:'inputmodel>/mypath',      type:'sap.ui.model.type.float',      contraints: {maximum : 1},      formatter:'.myformatter'}"   > </input> 

and add in controller function

mycontroller.prototype.myformatter(value){    return  value + "%"; } 

for further details have example in link sdn


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -