cancel
Showing results for 
Search instead for 
Did you mean: 

sap.m.list bind items with InputListItem

0 Kudos

Hi All ! I'm new with SAPUI5 and I'm trying to bind sap.m.list with InputListItem

I'm passing into the method a parameter that i want to be binded to the list

	_bindfilter: function(Filter) {


			var oList = this.getView().byId("list");
			var array = [];
			array.push(Filter);
				debugger;
			oList.setModel(new sap.ui.model.json.JSONModel(array));


			var oTemplate = new sap.m.InputListItem({
					label: "{NameF0}"


			});
			oList.bindAggregation("array", oTemplate);


		


		},

and there is the data wich passing in the parameters

I have to bind my list with "NameF0" and "NameR0"

thanks for help in advance

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Guys ! It works now 😄

there is my code

	_bindfilter: function(Filter) {


			var oList = this.getView().byId("list");
			var array = [];
			oList.setHeaderText("metadata");


			array.push(Filter);
			var Filter2 = {
				"metadata": array
			};
			var oModel = new sap.ui.model.json.JSONModel();
			oModel.setData(Filter2);
			oList.setModel(oModel);


			var oTemplate = new sap.m.InputListItem({
				label: "{NameF0}",
				content: [new sap.m.Button("but4", {
					text: "Button4"
				})]


			});
			
			oList.bindAggregation("items", "/metadata", oTemplate);


			oList.setBusy(false);
			debugger;
		},

thanks for your help

Answers (3)

Answers (3)

0 Kudos

Do you have an idea how to create many InputListItem in the oTemplate ?

former_member227918
Active Contributor
0 Kudos

I think you need to pass content (ui5 control) to input list item, something like below,

var oTemplate =new sap.m.InputListItem({
					label:"{/NameF0}",
                                        content: [ some control like label or input]
});

0 Kudos

same error 😞
Error: Missing template or factory function for aggregation items of Element

0 Kudos

do you have any example even binding list with static values like string in label

former_member365727
Active Contributor
0 Kudos

for sap.m.List there is no aggregation called "array" .......so oList.bindAggregation("array", oTemplate); will fail

use below code...

	_bindfilter: function(Filter) {
			var oList = this.getView().byId("list");
			var array = [];
			array.push(Filter);
				debugger;
			oList.setModel(new sap.ui.model.json.JSONModel(array));
			var oTemplate = new sap.m.InputListItem({
					label: "{/NameF0}"


			});
			oList.bindAggregation("items", oTemplate);	


		}
0 Kudos

Thanks for your response but when I did like you said

there is an error = "Uncaught Error: Missing template or factory function for aggregation items of Element sap.m.List#__xmlview0--list !"

0 Kudos

do you have any example even binding list with static values like string in label