Tuesday, 25 December 2018

m.table js

table.view.js:
sap.ui.jsview("m.table.table", {
getControllerName : function() {
return "m.table.table";
},
createContent : function(oController) {
var oModel = new sap.ui.model.json.JSONModel([
                                               { value: 50, name: "ramu" },
                                               { value: 60, name: "ravi" },
                                               { value: 70, name: "raju" },
                                               { value: 80, name: "rao" }
                                             ]);

                                             var oTable = new sap.m.Table({
                                            id:"otable",
                                               columns: [
                                                 new sap.m.Column({ header: new sap.m.Label({text: "Name"})}),
                                                 new sap.m.Column({ header: new sap.m.Label({text: "Value"})})
                                               ],
                                               items: {
                                                 path: "/",
                                                 template: new sap.m.ColumnListItem({
                                                   cells: [
                                                     new sap.m.Text({ text: "{name}" }),
                                                     new sap.m.Text({ text: "{value}" })
                                                   
                                                   ]
                                                 })
                                               },
                                             });
                                           
                                             oTable.setModel(oModel);
                                             var btn1 =new sap.m.Button({
                                            id:"bt",
                              text:"button2",
                              press:function(){
                              oTable.removeColumn("value");
                              }
                             
                              }).addStyleClass("123");

return new sap.m.Page({
title: "Title",
showHeader:false ,
content: [
              oTable,btn1
]
});
}

});
index.html:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

<script src="resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.m"
data-sap-ui-theme="sap_bluecrystal">
</script>
<!-- only load the mobile lib "sap.m" and the "sap_bluecrystal" theme -->

<script>
sap.ui.localResources("m.table");
var app = new sap.m.App({initialPage:"idtable1"});
var page = sap.ui.view({id:"idtable1", viewName:"m.table.table", type:sap.ui.core.mvc.ViewType.JS});
app.addPage(page);
app.placeAt("content");
</script>
<style>
#otable{
background-color: yellow;
 
}
.123{
background-color: dodgerblue;
justify-content:flex-end;
}
</style>

</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>
output:

custom control

NewControl.js:
sap.ui.define([
"sap/ui/core/Control",
"sap/m/RatingIndicator",
"sap/m/Label",
"sap/m/Button"

], function (Control, RatingIndicator, Label, Button) {
"use strict";
return Control.extend("control.NewControl", {
metadata : {
properties : {
value: {type : "float", defaultValue : 0}
},
aggregations : {
_rating : {type : "sap.m.RatingIndicator", multiple: false, visibility : "hidden"},
_label : {type : "sap.m.Label", multiple: false, visibility : "hidden"},
_button : {type : "sap.m.Button", multiple: false, visibility : "hidden"}
},
events : {
change : {
parameters : {
value : {type : "int"}
}
}
}
},
init : function () {
this.setAggregation("_rating", new RatingIndicator({
value: this.getValue(),
iconSize: "2rem",
visualMode: "Half",
liveChange: this._onRate.bind(this)
}));
this.setAggregation("_label", new Label({
text: "{i18n>productRatingLabelInitial}"
}).addStyleClass("sapUiSmallMargin"));
this.setAggregation("_button", new Button({
text: "{i18n>productRatingButton}",
press: this._onSubmit.bind(this)
}).addStyleClass("sapUiTinyMarginTopBottom"));
},

setValue: function (fValue) {
this.setProperty("value", fValue, true);
this.getAggregation("_rating").setValue(fValue);
},

reset: function () {
var oResourceBundle = this.getModel("i18n").getResourceBundle();

this.setValue(0);
this.getAggregation("_label").setDesign("Standard");
this.getAggregation("_rating").setEnabled(true);
this.getAggregation("_label").setText(oResourceBundle.getText("productRatingLabelInitial"));
this.getAggregation("_button").setEnabled(true);
},

_onRate : function (oEvent) {
var oRessourceBundle = this.getModel("i18n").getResourceBundle();
var fValue = oEvent.getParameter("value");

this.setProperty("value", fValue, true);

this.getAggregation("_label").setText(oRessourceBundle.getText("productRatingLabelIndicator", [fValue, oEvent.getSource().getMaxValue()]));
this.getAggregation("_label").setDesign("Bold");
},

_onSubmit : function (oEvent) {
var oResourceBundle = this.getModel("i18n").getResourceBundle();

this.getAggregation("_rating").setEnabled(false);
this.getAggregation("_label").setText(oResourceBundle.getText("productRatingLabelFinal"));
this.getAggregation("_button").setEnabled(false);
this.fireEvent("change", {
value: this.getValue()
});
},
renderer : function (oRM, oControl) {
oRM.write("<div");
oRM.writeControlData(oControl);
oRM.addClass("myAppDemoWTProductRating");
oRM.writeClasses();
oRM.write(">");
oRM.renderControl(oControl.getAggregation("_rating"));
oRM.renderControl(oControl.getAggregation("_label"));
oRM.renderControl(oControl.getAggregation("_button"));
oRM.write("</div>");
}
});});
App.controller.js:
sap.ui.controller("sap.ui.core.n-t.n-t.App", {
App.view.xml:
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
controllerName="sap.ui.core.n-t.n-t.App" xmlns:html="http://www.w3.org/1999/xhtml">

<App id="app"></App>


</core:View>
master.controller.js:
sap.ui.controller("sap.ui.core.n-t.n-t.master", {



onPress: function(oEvent)
  {
  var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
  oRouter.navTo("second");
  }
 
master.view.xml:
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:cntrl="control"
controllerName="sap.ui.core.n-t.n-t.master" xmlns:html="http://www.w3.org/1999/xhtml">
<Page title="Master view">
<content>
<VBox>
  <Label text="Welcome on the first view !" />
  <Button text="Navigate to the second view" press="onPress" />
  <cntrl:NewControl value="2" />
  </VBox>
</content>
</Page>
</core:View>
Slave.controller.js:
sap.ui.controller("sap.ui.core.n-t.n-t.Slave", {


onBack: function()
  {
sap.ui.controller("sap.ui.core.n-t.n-t.master").onPress();


  var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
  oRouter.navTo("master", true);
 
  }
Slave.view.xml:
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
controllerName="sap.ui.core.n-t.n-t.Slave" xmlns:html="http://www.w3.org/1999/xhtml">
<Page title="Slave view">
<content>
<VBox>
  <Label text="Welcome on the second view !" />
  <Button text="Navigate back to the first view" press="onBack" />
  </VBox>
</content>
</Page>
</core:View>
Component.js:
sap.ui.define( ["sap/ui/core/UIComponent"], function (UIComponent) {
"use strict";
return UIComponent.extend("sap.ui.core.n-t", {

metadata: {
"manifest":"json"

},

init : function () {
UIComponent.prototype.init.apply(this, arguments);

// Parse the current url and display the targets of the route that matches the hash
this.getRouter().initialize();
}

});
}, /* bExport= */ true);
index.html:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

<script src="resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.m"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-resourceroots='{
            "sap.ui.core.n-t": "./"
         }'>
</script>
<!-- only load the mobile lib "sap.m" and the "sap_bluecrystal" theme -->

<script>
sap.ui.localResources("control");
sap.ui.getCore().attachInit(function () {
            new sap.ui.core.ComponentContainer({
               name : "sap.ui.core.n-t"
            }).placeAt("content");

         });
</script>

</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>
manifest.json:
 {
  "_version": "1.8.0",
 
  "sap.ui5": {

"models": {

},"rootView": {
"viewName": "sap.ui.core.n-t.n-t.App",
"type": "XML",
"async": true
},
"routing": {
  "config": {
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"viewPath": "sap.ui.core.n-t.n-t",
"controlId": "app",
"controlAggregation": "pages",
"async": true
  },
  "routes": [
{
  "pattern": "",
  "name": "master",
  "target": "master"
},
{
  "pattern": "second",
  "name": "second",
  "target": "second"
}
  ],
  "targets": {
"master": {
  "viewID": "master",
  "viewName": "master"
},
"second": {
  "viewId": "Slave",
  "viewName": "Slave"
}
  }
}
  }
}
 
output:

routing

routing:
App.controller.js:
sap.ui.controller("routing1.routing.App", {
App.view.xml:
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
controllerName="routing1.routing.App" xmlns:html="http://www.w3.org/1999/xhtml">


<App id="app"></App>

</core:View>
child.controller.js:
sap.ui.controller("routing1.routing.child", {


onBack: function()
  {

  var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
  oRouter.navTo("master", true);
 
  }
child.view.xml:
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
controllerName="routing1.routing.child" xmlns:html="http://www.w3.org/1999/xhtml">
<Page title="child view">
<content>
<VBox>
  <Label text="Welcome on the second view !" />
  <Button text="Navigate back to the first view" press="onBack" />
  </VBox>
</content>
</Page>
</core:View>

 master.controller.js:
sap.ui.controller("routing1.routing.master", {



onPress: function(oEvent)
  {
  var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
  oRouter.navTo("second");
  }
master.view.xml:
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
controllerName="routing1.routing.master" xmlns:html="http://www.w3.org/1999/xhtml">
<Page title="Master view">
<content>
<VBox>
  <Label text="Welcome on the first view !" />
  <Button text="Navigate to the second view" press="onPress" />
  </VBox>
</content>
</Page>
</core:View>
Component-preload.js:
Component.js:
sap.ui.define( ["sap/ui/core/UIComponent"], function (UIComponent) {
"use strict";
return UIComponent.extend("routing1", {

metadata: {
"manifest":"json"
},

init : function () {
UIComponent.prototype.init.apply(this, arguments);

// Parse the current url and display the targets of the route that matches the hash
this.getRouter().initialize();
}

});
}, /* bExport= */ true);
index.html:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

<script src="resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.m"
data-sap-ui-theme="sap_bluecrystal"
        data-sap-ui-resourceroots='{
            "routing1": "./"
         }'>

</script>
<!-- only load the mobile lib "sap.m" and the "sap_bluecrystal" theme -->

<script>
sap.ui.getCore().attachInit(function () {
            new sap.ui.core.ComponentContainer({
               name : "routing1"
            }).placeAt("content");

         });

</script>

</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>
manifest.json:
{
  "_version": "1.8.0",
 
  "sap.ui5": {

"models": {

},"rootView": {
"viewName": "routing1.routing.App",
"type": "XML",
"async": true
},
"routing": {
  "config": {
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"viewPath": "routing1.routing",
"controlId": "app",
"controlAggregation": "pages",
"async": true
  },
  "routes": [
{
  "pattern": "",
  "name": "master",
  "target": "master"
},
{
  "pattern": "second",
  "name": "second",
  "target": "second"
}
  ],
  "targets": {
"master": {
  "viewID": "master",
  "viewName": "master"
},
"second": {
  "viewId": "child",
  "viewName": "child"
}
  }
}
  }
}
output:


overlaycontainer

overlaycontainer.view.js:
sap.ui.jsview("overlaycontainer.overlaycontainer", {


getControllerName : function() {
return "overlaycontainer.overlaycontainer";
},


createContent : function(oController) {
function handler(oEvent) {
alert("Event '"+oEvent.getId()+"' triggered");
}

var oOverlayContainer = new sap.ui.ux3.OverlayContainer();
oOverlayContainer.addContent(new sap.ui.commons.TextView({text: "Some Content ..."}));
oOverlayContainer.addContent(new sap.m.Button({text:"button"}));
       
oOverlayContainer.attachClose(handler);
oOverlayContainer.attachOpen(handler);
oOverlayContainer.attachOpenNew(handler);

var oButton = new sap.ui.commons.Button({
text: "Open Overlay Container",
press: function(oEvent){
if(!oOverlayContainer.isOpen()){
oOverlayContainer.open();
}
}
}).addStyleClass("red");
  return new sap.m.Page({
title: "Title",
content: [
oButton
]
});
}

});
output:

Monday, 24 December 2018

treetable

sap.ui.jsview("treetable.treetable", {


getControllerName : function() {
return "treetable.treetable";
},


createContent : function(oController) {
oTableData={
      root:{ branch:"br",details:"br details",
      0:{ branch:"mech",details:"mechanical engg",
    0:{subject:"Dynamics",grade:"3"},
    1:{subject: "hydraulics",grade:"4"}
      },
    1: { branch:"elec",details:"electrical engg",
     
    0:{subject:"circuit theory",grade:"4"},
    1:{subject: "elec motors",grade:"4"}
      },
     2: { branch:"ece",details:"electrical engg",
    0:{subject:"analog electronics",grade:"4"},
    1:{subject: "digital electronics",grade:"3"}
      },
  3: { branch:"cse",details:" coputer sc engg",
    0:{subject:"c programming",grade:"3"},
    1:{subject: " c++ programming",grade:"4"}
      }
                    }
};
oTable = new sap.ui.table.TreeTable({
columns: [
new sap.ui.table.Column({label: "Branch", template: "branch"}),
new sap.ui.table.Column({label: "Subject", template: "subject"}),
new sap.ui.table.Column({label: "Details", template: "details"}),
new sap.ui.table.Column({label: "Grade", template: "grade"})
],

});
oModel= new sap.ui.model.json.JSONModel();
oModel.setData(oTableData);
oTable.setModel(oModel);
oTable.bindRows("/root");

  return new sap.m.Page({
title: "Title",
content: [
oTable
]
});
}

});
output:

i18n demo

i18n_ch.properties:
greet=\u4F60\u597D
i18n_de.properties:
greet=hallo
i18n.properties:
greet=hello

demo.controller.js:
onInit: function() {
//var sLoc=sap.ui.getCore().getConfiguration().getLanguage();
var sLoc="zh_Hans";
var i18npath="i18n/i18n";
if(sLoc==="de"){
i18npath=i18npath+"_de.properties";
}else if(sLoc==="zh_Hans"){
i18npath=i18npath+"_ch.properties";
}else{
i18npath=i18npath+".properties";
}
var oi18nModel=new sap.ui.model.resource.ResourceModel({
bundleUrl:i18npath
});
sap.ui.getCore().setModel(oi18nModel,"i18n")
},
demo.view.js:
sap.ui.jsview("i18ndemo.demo", {


getControllerName : function() {
return "i18ndemo.demo";
},


createContent : function(oController) {
var oBtn= new sap.m.Button({
text:"{i18n>greet}"
})
  var opage= new sap.m.Page({
title: "i18n example",
content: [
oBtn
]
});
  return opage
}


});
output:

Tuesday, 4 December 2018

xml form sapui5

form.view.xml:
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
controllerName="xmlform.form" xmlns:f="sap.ui.layout.form">
<Page title="Title">
<content>
<f:SimpleForm editable="false" layout="ResponsiveGridLayout" id="SimpleForm">
<f:content id="FormContent">
<core:Title text="Title"/>
<Label text="Label 1" id="Label1"/>
<Input width="100%" id="Input1" value="Input 1" enabled="false"/>
<Input width="100%"  id="Input2" value="Input 2" enabled="false"/>
<Label text="Label 2" id="Label2"/>
<Input width="100%"  id="Input3" value="Input 3" enabled="false"/>
</f:content>
</f:SimpleForm>
</content>
</Page>
</core:View>
output:

xmltable sapui5

view.controller.js:

sap.ui.define([

               "sap/ui/core/mvc/Controller"

             ], function(Controller) {

               "use strict";

                return Controller.extend("xmltable.view", {

             

               onInit: function() {

               

             

               var datapath=

               [{"name":"Sai Giridhar","company":"SAP"},

                     {"name":"Vignesh","company":"TCS"},

                     {"name":"Mike","company":"SAP"}];

             

               var oModel = new sap.ui.model.json.JSONModel(datapath);
        this.getView().setModel(oModel);

               }

               });

             });

     view.view.xml:
<core:View

xmlns:core="sap.ui.core"
controllerName="xmltable.view"

xmlns:html="http://www.w3.org/1999/xhtml"

xmlns:mvc="sap.ui.core.mvc"

xmlns="sap.m"

xmlns:table="sap.ui.table">

 



  <Page title="table">

  <content>

  <table:Table id="Table1" rows="{/}">

            <table:title>

            <Text text="SAPUI5 sap.ui.table XML view"></Text>

            </table:title>

            <table:columns>

                        <table:Column sortProperty="name" filterProperty="name">

                                  <Label text="Employee name"/>

                                        <table:template><Text text="{name}" ></Text></table:template>

                        </table:Column>

                        <table:Column sortProperty="company" filterProperty="company">

                                  <Label text="Company"/>

                                        <table:template><Text text="{company}" ></Text></table:template>

                        </table:Column>

            </table:columns>

  </table:Table>

  </content>

  </Page>

 

 
</core:View>
output:


grid sapui5 js

grid.view.js:
sap.ui.jsview("grid.grid", {


getControllerName : function() {
return "grid.grid";
},


createContent : function(oController) {
var oGridForm = new sap.ui.layout.Grid({
hSpacing: 1,
vSpacing: 1,
content: [
new sap.ui.commons.Label({
id:"lbl1",
text: 'Firstname',
layoutData : new sap.ui.layout.GridData({
span: "L3 M3 S5"
})
}).addStyleClass("labelClass"),
new sap.ui.commons.TextField({
id:"fld",
width: "100%",
layoutData : new sap.ui.layout.GridData({
span: "L7 M9 S12"
})
}).addStyleClass("txtFldClass"),
new sap.ui.commons.Label({
text: 'Lastname',
layoutData : new sap.ui.layout.GridData({
span: "L3 M3 S12",

})
}).addStyleClass("labelClass"),
new sap.ui.commons.TextField({
width: "100%",
layoutData : new sap.ui.layout.GridData({
span: "L7 M9 S12"
})
}),
new sap.ui.commons.Label({
text: "ZIP / City",
layoutData : new sap.ui.layout.GridData({
span: "L3 M3 S12",

})
}).addStyleClass("labelClass"),
new sap.ui.commons.TextField({
width: "100%",
layoutData : new sap.ui.layout.GridData({
span: "L1 M1 S12"
})
}),
new sap.ui.commons.TextField({
width: "100%",
layoutData : new sap.ui.layout.GridData({
span: "L6 M8 S12"
})
}),
new sap.ui.commons.Button({
text: 'Submit',
width: "100%",
layoutData : new sap.ui.layout.GridData({
indent: "L3 M3",
span: "L3 M3 S12"
})
})
]
});

  return new sap.m.Page({
title: "Title",
content: [
oGridForm
]
});
}

});
index.html:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

<script src="resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.m,sap.ui.layout,sap.ui.commons"
data-sap-ui-theme="sap_bluecrystal">
</script>
<!-- only load the mobile lib "sap.m" and the "sap_bluecrystal" theme -->

<script>
sap.ui.localResources("grid");
var app = new sap.m.App({initialPage:"idgrid1"});
var page = sap.ui.view({id:"idgrid1", viewName:"grid.grid", type:sap.ui.core.mvc.ViewType.JS});
app.addPage(page);
app.placeAt("content");
</script>
<style>
.labelClass{
color:red;}
</style>
</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>
output:

vizframe stackedcolumn sapui5 js


index.html:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

<script src="resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.m,sap.viz,sap.ui.layout,sap.ui.table,sap.ui.commons"
data-sap-ui-theme="sap_bluecrystal">
</script>
<!-- only load the mobile lib "sap.m" and the "sap_bluecrystal" theme -->

<script>
sap.ui.localResources("vizframe");
var app = new sap.m.App({initialPage:"idvizframe1"});
var page = sap.ui.view({id:"idvizframe1", viewName:"vizframe.vizframe", type:sap.ui.core.mvc.ViewType.JS});
app.addPage(page);
app.placeAt("content");
</script>

</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>
vizframe.view.js:
sap.ui.jsview("vizframe.vizframe", {


getControllerName : function() {
return "vizframe.vizframe";
},


createContent : function(oController) {



  // some business data
var oModel = new sap.ui.model.json.JSONModel({
businessData : [
{Country :"Canada",revenue:410.87,profit:-141.25, population:34789000},
{Country :"China",revenue:338.29,profit:133.82, population:1339724852},
{Country :"France",revenue:487.66,profit:348.76, population:65350000},
{Country :"Germany",revenue:470.23,profit:217.29, population:81799600},
{Country :"India",revenue:170.93,profit:117.00, population:1210193422},
{Country :"United States",revenue:905.08,profit:609.16, population:313490000}
]
});

// A Dataset defines how the model data is mapped to the chart
var oDataset = new sap.viz.ui5.data.FlattenedDataset({
dimensions : [{axis : 1, name : 'Country', value : "{Country}"}],
measures : [
{name : 'Profit', value : '{profit}'},
{name : 'Revenue', value : '{revenue}'}
],
data : {path : "/businessData"}
});
// create a Bar chart
    // you also might use Combination, Line, StackedColumn100, StackedColumn or Column
    // for Donut and Pie please remove one of the two measures in the above Dataset. 
   
  var oVizFrame = new sap.viz.ui5.controls.VizFrame({
'width': '90%',
'height': '400px',
  'vizType' : 'stacked_column',
    dataset: oDataset
  });
  oVizFrame.setModel(oModel)
  var feedPrimaryValues = new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid' : "valueAxis",
'type' : "Measure",
'values' : ["Profit", "Revenue"]
  }), feedAxisLabels = new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid' : "categoryAxis",
'type' : "Dimension",
'values' : ["Country"]
  });
  oVizFrame.addFeed(feedPrimaryValues);
oVizFrame.addFeed(feedAxisLabels);

  return new sap.m.Page({
title: "Title",
content: [
oVizFrame
]
});
}

});
output:

sapui5 table formatters

sample.controller.js:
sap.ui.controller("sample.sample", {

     sample:function(){
    var oTable= sap.ui.getCore().byId("mytable");
    oTable.addColumn(new sap.ui.table.Column({
    id:"ot",
    label: new sap.ui.commons.Label({text: "status"}),
    template: new sap.ui.commons.TextView({text:{path:"status",formatter:function(status)
    {
    if(status==1)
    {
    return true
    }
    else if (status==0)
    {
    return false
    }
    }}})
  }));
     }
});
sample.view.js:
sap.ui.jsview("sample.sample", {


getControllerName : function() {
return "sample.sample";
},


createContent : function(oController) {

var data = [
    {lastName: "Dente", Name: "Al",status:1},
    {lastName: "Friese", Name: "Andy",status:0},
    {lastName: "Mann", Name: "Anita",status:1}
  ];
var oModel = new sap.ui.model.json.JSONModel();
  oModel.setData(data);
var oTable = new sap.ui.table.Table({
id:"mytable",
visibleRowCount: 3,
        width : "85%"
});
 
  oTable.addColumn(new sap.ui.table.Column({
    label: new sap.ui.commons.Label({text: "lastName"}),
    template: new sap.ui.commons.TextView({text:"{lastName}"})
  }));
  oTable.addColumn(new sap.ui.table.Column({
    label: new sap.ui.commons.Label({text: "Name"}),
    template: new sap.ui.commons.TextView({text:"{Name}"})
  }));
  oTable.setModel(oModel);
  oTable.bindRows("/");
var btn =new sap.m.Button({
        text:"button1",
        press:oController.sample
        });
        var btn1 =new sap.m.Button({
        text:"button2",
        press:function(){
        oTable.removeColumn(sap.ui.getCore().byId("ot") );
        }

       
       
        });
        var oHBox1 = new sap.m.HBox({
    items:[
    oTable,
    btn,btn1,
   
    ]
    });
        var oModel = new sap.ui.model.json.JSONModel({
        businessData : [
        {Country :"Canada",revenue:410.87,profit:-141.25, population:34789000},
        {Country :"China",revenue:338.29,profit:133.82, population:1339724852},
        {Country :"France",revenue:487.66,profit:348.76, population:65350000},
        {Country :"Germany",revenue:470.23,profit:217.29, population:81799600},
        {Country :"India",revenue:170.93,profit:117.00, population:1210193422},
        {Country :"United States",revenue:905.08,profit:609.16, population:313490000}
        ]
        });
       
           
        var oDataset = new sap.viz.ui5.data.FlattenedDataset({
        dimensions : [
        {
        axis : 1, 
        name : 'Country',
        value : "{Country}"
        }
        ],
        measures : [
        {
        name : 'Profit', 
        value : '{profit}'   
        },
        {
        name : 'Revenue',
        value : '{revenue}'
        }
        ],
        data : {
        path : "/businessData"
        }
       
        });
 
        var oBarChart = new sap.viz.ui5.Bar({
        width : "80%",
        height : "400px",
        plotArea : {
        },
        title : {
        visible : true,
        text : 'Profit and Revenue By Country'
        },
        dataset : oDataset
        });
        oBarChart.setModel(oModel);
        var oVBox2 = new sap.m.VBox("Vbox2", {
    items:[
   
                              oBarChart
    ]
    });
       

  return new sap.m.Page({
title: "Title",
content: [
             oHBox1,oVBox2
]
});
}

});
index.html:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

<script src="resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.m,sap.viz,sap.ui.layout,sap.ui.table,sap.ui.commons"
data-sap-ui-theme="sap_bluecrystal">
</script>
<!-- only load the mobile lib "sap.m" and the "sap_bluecrystal" theme -->

<script>
sap.ui.localResources("sample");
var app = new sap.m.App({initialPage:"idsample1"});
var page = sap.ui.view({id:"idsample1", viewName:"sample.sample", type:sap.ui.core.mvc.ViewType.JS});
app.addPage(page);
app.placeAt("content");
</script>

</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>
output:


table cell click alert massage

tablesa.view.js:
sap.ui.jsview("tablesa.tablesa", {

 
getControllerName : function() {
return "tablesa.tablesa";
},


createContent : function(oController) {
var data = [ {fname : "indrajith" , lname : "SCN"},
             {fname : "fred" , lname : "SCN1"},
             {fname : "den" , lname : "SCN2"},
             {fname : "foo" , lname : "SCN3"},
             {fname : "red" , lname : "SCN4"},
            ]
var oModel = sap.ui.model.json.JSONModel();
oModel.setData(data)

var oTable = new sap.m.Table({
mode: sap.m.ListMode.SingleSelectMaster,

columns: [
          new sap.m.Column({
             
              header : new sap.m.Label({
                  text : "First Name"
              })
          }),
          new sap.m.Column({
           
              header : new sap.m.Label({
                  text : "Last Name"
              })
          })
        ],
       
       
 
});

oTable.setModel(oModel)


oTable.bindAggregation("items", {
        path: "/",
        template: new sap.m.ColumnListItem({
            cells: [
                (new sap.m.Text({ text: "{fname}" }).attachBrowserEvent("click",function(e){
var pid = e.target.id
            /* alert(pid);*/
alert(sap.ui.getCore().byId(pid).getText())
})),
                    (new sap.m.Text({ text: "{lname}" }).attachBrowserEvent("click",function(e){
var pid = e.target.id
                /*alert(pid);*/
alert(sap.ui.getCore().byId(pid).getText())
})),
                   
                    ]
        })

})

  return new sap.m.Page({
title: "Title",
content: [
oTable
]
});
}


});

output:

test ganaral binding(testing )

  /home/user/projects/project1/webapp/model/record.json: {     "text" : "outer text" ,     "myrecorsd" : [    ...