cancel
Showing results for 
Search instead for 
Did you mean: 

Template or data aggregation not binded?

gouse_234
Discoverer
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

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>