on 12-16-2023 3:59 AM
My code goes as
View (XML - Main.view.xml):<mvc:View
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m"
controllerName="your.controller.name">
<Table id="myTable" items="{/tableData}">
<columns>
<Column>
<Text text="Promo Type" width="100%"/>
</Column>
<Column>
<Text text="Promo Description" width="100%"/>
</Column>
<Column>
<Text text="Package Description" width="100%"/>
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<Select items="{/promoTypes}" selectedKey="{promoType}"/>
<Select items="{/promoDescriptions}" selectedKey="{promoDescription}"/>
<Select items="{/packageDescriptions}" selectedKey="{packageDescription}"/>
</cells>
</ColumnListItem>
</items >
</Table>
</mvc:View>
And controller
Controller (JavaScript - Main.controller.js):sap.ui.define([
"sap/ui/core/mvc/Controller",
"sap/m/Select",
"sap/m/ColumnListItem",
"sap/m/Table",
"sap/m/Column",
"sap/m/Text",
"sap/ui/model/json/JSONModel"
], function(Controller, Select, ColumnListItem, Table, Column, Text, JSONModel) {
"use strict";
return Controller.extend("your.controller.name", {
onInit: function() {
// Sample data
var oModel = new JSONModel({
tableData: [{
promoType: "",
promoDescription: "",
packageDescription: ""
}]
});
// Dropdown data
oModel.setProperty("/promoTypes", ["Type1", "Type2", "Type3"]);
oModel.setProperty("/promoDescriptions", ["Desc1", "Desc2", "Desc3"]);
oModel.setProperty("/packageDescriptions", ["Package1", "Package2", "Package3"]);
this.getView().setModel(oModel);
}
});
});
Now getting a error while preview application is that 1.missing template or factory function for aggregation items of elements on selectbox,
2.Application started without loaded data
Could anyone suggest where the issue is and how to modify the code
you need something for the select. this is just example.
<Select
enabled="{/Enabled}"
editable="{/Editable}"
forceSelection="false"
selectedKey="{/SelectedProduct2}"
items="{
path: '/ProductCollection2',
sorter: { path: 'Name' }
}">
<core:Item key="{ProductId}" text="{Name}" />
</Select>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.