Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<script src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js" 
  
id="sap-ui-bootstrap" data-sap-ui-theme="sap_belize" 
  
data-sap-ui-libs="sap.m"></script>
  
  <script>
            var oData = {'normalText': 'abc', 'boldText' : '(Self)fabc'};
            var oModel = new sap.ui.model.json.JSONModel();
            oModel.setData(oData);
            var oVBox = new sap.m.VBox();
            var oText1 = new sap.m.Text({
                text: {
                            path: '/normalText',
                            formatter: textBold
                        }
              ,id:"normaltext"
            });
            
            var textBold = function(sText) {
              if(sText.indexOf("(Self)") > -1) {
                  this.addStyleClass("boldText");
              }
              return sText;
            };
    
            var oText2 = new sap.m.Text({
                        text: {
                            path: '/boldText',
                            formatter: textBold
                        },
                       id:"boltext"
                      }
                    );
    
            
            oVBox.setModel(oModel);
            oVBox.addItem(oText1);
            oVBox.addItem(oText2);
            oVBox.placeAt('content');
        </script>
<body id="content" class="sapUiBody">
    </body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers