/scripts/ahub.form.attachments.js
0

sap.m.list bind items with InputListItem

Apr 19, 2017 at 03:49 PM

123

avatar image
Former Member

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

capture.png (17.2 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
avatar image
Former Member Apr 20, 2017 at 10:13 AM
0

Hi Guys ! It works now :D

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

Share
10 |10000 characters needed characters left characters exceeded
Srikanth KV Apr 19, 2017 at 03:56 PM
0

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);	


		}
Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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
Former Member

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

0
Akhilesh Upadhyay Apr 20, 2017 at 07:29 AM
0

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]
});

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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

0
Former Member

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

0
avatar image
Former Member Apr 20, 2017 at 10:25 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Skip to Content