sap.m.list bind items with InputListItem

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)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Apr 20, 2017 at 10:13 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 19, 2017 at 03:56 PM

    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);	
    
    
    		}
    Add comment
    10|10000 characters needed characters exceeded

  • Apr 20, 2017 at 07:29 AM

    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]
    });
    
    
    Add comment
    10|10000 characters needed characters exceeded

  • Apr 20, 2017 at 10:25 AM

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

    Add comment
    10|10000 characters needed characters exceeded

Skip to Content