This is my view.js
createContent : function(oController) {
var oItemTemplate = new sap.ui.core.ListItem({text:"{year}"});
var oItemTemplate1 = new sap.ui.core.ListItem({text:"{session}"});
var oLayout1 = new sap.ui.layout.form.ResponsiveGridLayout({
});
var calenderForm = new sap.ui.layout.form.Form("F1", {
layout: oLayout1,
formContainers: [new sap.ui.layout.form.FormContainer("F1C2", {
title: new sap.ui.core.Title({
text: "Academic Calender",
tooltip: "calender"
}),
formElements: [new sap.ui.layout.form.FormElement({
label: "Academic Year",
fields: [new sap.m.Select({
change : this.getView().byId("table1").setVisible(true),
width:"60%",
items:{path:"/adata",template:oItemTemplate }
}),new sap.m.Label({
text:"Academic session",
}),new sap.m.Select({
width:"60%",
items:{path:"/adata",template:oItemTemplate1 }
})]
}),
new sap.ui.layout.form.FormElement({
fields: [new sap.m.Button({text:"Display Calender",
width:"13%",
press: function(oEvent){
}
})]
})
]
})]
});
var oTable = new sap.m.Table("table1",{
});
var col1 = new sap.m.Column({header: new sap.m.Label({text:"Batch Number"}),
});
oTable.addColumn(col1);
var col2 = new sap.m.Column({header: new sap.m.Label({text:"Batch Generation Date"}),
});
oTable.addColumn(col2);
var col3 = new sap.m.Column({header: new sap.m.Label({text:"Details"}),
});
oTable.addColumn(col3);
var col4 = new sap.m.Column({header: new sap.m.Label({text:"Download"}),
});
oTable.addColumn(col4);
var col5 = new sap.m.Column({header: new sap.m.Label({text:"Type of Document"}),
});
oTable.addColumn(col5);
oTable.bindItems("/data", new sap.m.ColumnListItem({
cells : [ new sap.m.Text({
text : "{BatchNumber}"
}), new sap.m.Text({
text : "{BatchGenerationDate}"
}), new sap.m.Button({
text : "{Details}",
press : function(){
alert:(jhj);
}
}), new sap.m.Button({
text : "{Download}"
}), new sap.m.Text({
text : "{Document}"
}),
]
}));
return calenderForm;
}
});
This is my controller.js
onInit: function(){
var dropdwnValues = {"adata":[{"year":""},
{"year":"2014-2015","session":"Spring"},
{"year":"2015-2016","session":"Hibernet"},
{"year":"2016-2017","session":"JAVA"},
{"year":"2017-2018","session":"C++"},
{"year":"2018-2019","session":"Python"}
]};
var model = new sap.ui.model.json.JSONModel();
model.setData(dropdwnValues);
this.getView().setModel(model);
var oModel = new sap.ui.model.json.JSONModel("table.json");
sap.ui.getCore().setModel(oModel);
this.getView().byId("table1").setVisible(false);
},