Skip to Content
0
Jul 15, 2020 at 08:31 AM

SAPUI5 Select Values are not visible

469 Views

Hi guys

I have a JSON-Model which I initialized in the init-function of my controller. In the view I created a select-control. So know the values are invisible but the dropdown is there.

I'm a bit fustrated because I don't see the error..

Please help me!

This is the code in my view:

<Select id="amountOfDaysSelector" items="{model>/Selector/WeekMonthSelector}">
	<core:ListItem text="{WeekMonthSelector}" />
</Select>

This is my controller:

onInit : function () {
	var oModel = new sap.ui.model.json.JSONModel({
		Selector: 
			{
				WeekMonthSelector: {
					day1: 1,
					day2: 2,
					day3: 3,
					day4: 4,
					day5: 5
					},
				MonthSelector: {
					day1: "gugus",
					day2: "supisupi"
				}
			}
	});
	this.getView().setModel(oModel, "model");
}

I also tried to add a path and sorter variable in the items property of the select-control. But it always started a HTTP-Request, which obviously failes because the data is not in the backend...

like this:

<Select id="amountOfDaysSelector" items="{
                             path: '/Selector',
                             sorter: {path: 'WeekMonthSelector'}}" />
   <core:ListItem text="{WeekMonthSelector}" />
</Select>

I'm looking forward of your answers.

Cheers,
Shana

Attachments