
Controller.js
<mvc:View controllerName="com.flexiblecolapp.controller.View1"
xmlns:mvc="sap.ui.core.mvc" displayBlock="true"
xmlns="sap.m"
xmlns:f="sap.f"
xmlns:smartList="sap.ui.comp.smartlist">
<Page id="page" title="{i18n>title}" titleAlignment="Center">
<content>
<f:FlexibleColumnLayout id="FlexibleColumnID" backgroundDesign="Transparent" initialBeginColumnPage="FirstPage" layout="ThreeColumnsBeginExpandedEndHidden">
<f:beginColumnPages>
<Page title="BeginColumnPage with Smart List">
<content>
<smartList:SmartList id="ItemsST" entitySet="Employees" listBindingPath="SmartListModel>/Employees" header="Employees List" showRowCount="true" showFullScreenButton="true" enableAutoBinding="true" selectFields="EmployeeID,FirstName,LastName,City,Region,Country">
<smartList:listItemTemplate>
<StandardListItem title="{SmartListModel>FirstName} {SmartListModel>LastName}" info="{SmartListModel>City}-{SmartListModel>Country}" description="{SmartListModel>Country}" icon="{path:'SmartListModel>Photo', formatter: '.formatPhoto'}" type="Navigation" press="onPressToSec" />
</smartList:listItemTemplate>
</smartList:SmartList>
</content>
</Page>
</f:beginColumnPages>
<f:midColumnPages>
</f:midColumnPages>
</f:FlexibleColumnLayout>
</content>
</Page>
</mvc:View>
xml code
sap.ui.define([
"sap/ui/core/mvc/Controller",
"sap/ui/model/json/JSONModel",
"sap/m/MessageBox"
],
/**
* @param {typeof sap.ui.core.mvc.Controller} Controller
*/
function (Controller, JSONModel, MessageBox) {
"use strict";
return Controller.extend("com.flexiblecolapp.controller.View1", {
onInit: function () {
var that = this;
// Enabling the Begin Column Page to Occupy Full screen Display //
var oFlexibleColumnLayout = this.getView().byId("FlexibleColumnID");
oFlexibleColumnLayout.setLayout(sap.f.LayoutType.OneColumn);
// Read Call Function for Employees Entity Set //
that.EmployeesReadCall();
},
EmployeesReadCall: function () {
var that = this;
//Model for Smart List//
var oModel = new sap.ui.model.json.JSONModel();
that.getView().setModel(oModel, "SmartListModel");
var oData = this.getOwnerComponent().getModel();
oData.read("/Employees", {
success: function (data, res) {
that.getView().getModel("SmartListModel").setData({
"Employees": data.results
});
},
error: function () {
alert("Could not load ODATA service!");
}
});
},
// Formatter for Displaying Images in Smart List Icon of Employees Photo property Conversion //
formatPhoto: function (sVal) {
var sTrimmed;
if (typeof sVal === "string") {
sTrimmed = sVal.substr(104);
return "data:image/bmp;base64," + sTrimmed;
}
},
});
});
Controller.js
Responsiveness
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
6 | |
5 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |