jquery - Function as a template for SAPUI5 table column -


is there way define function returns control dynamically template column in sapui5 table?

so 1 of columns in model contains comma separated value of image links can vary in number 1 many. depending on number of links, need show them in same cell of column. here's code wrote :

    var ocolumn2 = new sap.ui.table.column({         label: new sap.ui.commons.label({text: "fuel type"}),         width: "20%"     });     ocolumn2.bindaggregation("template", "/modeldata", function(sid, ocontext) {         var imglink = ocontext.getproperty("fueltype").split(",");          var fuellayout = new sap.ui.commons.layout.matrixlayout(sid, {             id : "fuelmatrix",             layoutfixed : true,             width:"100%",                });          var fuelrow = new sap.ui.commons.layout.matrixlayoutrow();         fuellayout.addrow(fuelrow);         var fuelcell = new sap.ui.commons.layout.matrixlayoutcell();         fuelrow.addcell(fuelcell);         (var n=0; n < imglink.length; n++){             fuelcell.addcontent(new sap.ui.commons.image({height:"30%", width:"30%", src:imglink[n]}))             }                    return fuellayout;     }); 

the problem same image repeats in every line...

you can use factory function in aggregation bindings, instead of control instance.

i've put jsbin example together, here's relevant section of code:

new sap.m.list()   .binditems('/people', function(sid, ocontext) {     return (ocontext.getproperty('number') % 2) ?       new sap.m.standardlistitem({         title: '{name}',         description: '{number}'       }) :       new sap.m.displaylistitem({         label: '{name}',         value: '{number}'       });   }); 

this simple example returns different style of list item depending on whether value of item's 'number' property or odd.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -