view.xml
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc"
xmlns:unified="sap.ui.unified" xmlns="sap.m" xmlns:l="sap.ui.layout" xmlns:f="sap.ui.layout.form"
controllerName="Forms.controller.S1" xmlns:html="http://www.w3.org/1999/xhtml">
<Page title="Forms">
<content>
<Table id="id_Table"
items="{/data}">
<columns>
<Column>
<Text text="Name" />
</Column>
<Column>
<Text text="Email" />
</Column>
<Column>
<Text text="Pan" />
</Column>
<Column>
<Text text="Mobile" />
</Column>
<Column>
<Text text="Actions" />
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<Text text="{Name}"/>
</cells>
<cells>
<Text text="{Email}" />
</cells>
<cells>
<Text text="{Pan}" />
</cells>
<cells>
<Text text="{Mobile}" />
</cells>
<cells>
<FlexBox>
<Button icon="sap-icon://display" type="Accept" press="onPress"/>
<Button icon="sap-icon://delete" type="Reject" press="onDelete"/>
</FlexBox>
</cells>
</ColumnListItem>
</items>
</Table>
<Toolbar>
<Button icon="sap-icon://add" type="Emphasized" press="onadd"/>
</Toolbar>
</content>
</Page>
</core:View>
Controller.js
onadd:function(){
if (!tat.bDialog) {
tat.bDialog = sap.ui.xmlfragment("Forms.view.form2", tat);
tat.getView().addDependent(tat.bDialog);
}
tat.bDialog.open();
},
onOk:function(evt){
var name=sap.ui.getCore().byId("nameId").getValue();
var email=sap.ui.getCore().byId("emailId").getValue();
var p=sap.ui.getCore().byId("panId").getValue();
var mob=sap.ui.getCore().byId("MobileId").getValue();
var addr=sap.ui.getCore().byId("addressId").getValue();
var com=sap.ui.getCore().byId("companyId").getValue();
var sal=sap.ui.getCore().byId("salaryId").getValue();
var qual=sap.ui.getCore().byId("QualificationId").getValue();
var pro=sap.ui.getCore().byId("ProjectId").getValue();
var blood=sap.ui.getCore().byId("BloodGroupId").getValue();
//var g=sap.ui.getCore().byId("rb").getValue();
//name.getSource().setValue();
var a=tat.getView().byId("id_Table").getModel().getData();
a.data.push({Name : name, Email : email,PANNumber: p,MobileNo: mob,Address: addr,Company: com,Salary: sal,Qualification: qual,Project: pro,BloodGroup: blood});
tat.oModel.refresh();
},
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc"
xmlns:unified="sap.ui.unified" xmlns="sap.m" xmlns:l="sap.ui.layout" xmlns:f="sap.ui.layout.form"
controllerName="Forms.controller.S1" xmlns:html="http://www.w3.org/1999/xhtml">
<Page title="Forms">
<content>
<Table id="id_Table"
items="{/data}">
<columns>
<Column>
<Text text="Name" />
</Column>
<Column>
<Text text="Email" />
</Column>
<Column>
<Text text="Pan" />
</Column>
<Column>
<Text text="Mobile" />
</Column>
<Column>
<Text text="Actions" />
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<Text text="{Name}"/>
</cells>
<cells>
<Text text="{Email}" />
</cells>
<cells>
<Text text="{Pan}" />
</cells>
<cells>
<Text text="{Mobile}" />
</cells>
<cells>
<FlexBox>
<Button icon="sap-icon://display" type="Accept" press="onPress"/>
<Button icon="sap-icon://delete" type="Reject" press="onDelete"/>
</FlexBox>
</cells>
</ColumnListItem>
</items>
</Table>
<Toolbar>
<Button icon="sap-icon://add" type="Emphasized" press="onadd"/>
</Toolbar>
</content>
</Page>
</core:View>
Controller.js
onadd:function(){
if (!tat.bDialog) {
tat.bDialog = sap.ui.xmlfragment("Forms.view.form2", tat);
tat.getView().addDependent(tat.bDialog);
}
tat.bDialog.open();
},
onOk:function(evt){
var name=sap.ui.getCore().byId("nameId").getValue();
var email=sap.ui.getCore().byId("emailId").getValue();
var p=sap.ui.getCore().byId("panId").getValue();
var mob=sap.ui.getCore().byId("MobileId").getValue();
var addr=sap.ui.getCore().byId("addressId").getValue();
var com=sap.ui.getCore().byId("companyId").getValue();
var sal=sap.ui.getCore().byId("salaryId").getValue();
var qual=sap.ui.getCore().byId("QualificationId").getValue();
var pro=sap.ui.getCore().byId("ProjectId").getValue();
var blood=sap.ui.getCore().byId("BloodGroupId").getValue();
//var g=sap.ui.getCore().byId("rb").getValue();
//name.getSource().setValue();
var a=tat.getView().byId("id_Table").getModel().getData();
a.data.push({Name : name, Email : email,PANNumber: p,MobileNo: mob,Address: addr,Company: com,Salary: sal,Qualification: qual,Project: pro,BloodGroup: blood});
tat.oModel.refresh();
},