Can we dynamically add widgets to a row template?

This thread was migrated from an old forum. It may contain information that are no longer valid. For further assistance, please post a new question or open a support ticket from the Customer Support portal.

During run time we would like to add few images to a flex container which is sitting on a row template. Is such an approach supported or should we have a pre-defined template ?

If its supported can you please point us to some code snippet which gives some insight into the approach?

Hi @Amvndv Nowth​ ,

You can switch rowTemplate itself dynamically for a segment. You can create a rowTemplate with images.

Whenever you have the data, you can assign row template to the segment first and then set data to the segment.

frm1.seg1.rowTemplate = flexWithImages1;

frm1.seg1.setData = {};

@Amvndv Nowth​

You can have your segment data like this:

var data = [

{lbl1:"one", lbl2:"two", lbl2:"three",template:boxRef1},

{lbl1:"one", lbl2:"two", lbl3:"three",template:boxRef2},

{lbl1:"one", lbl2:"two", lbl3: "three",template:boxRef3}

]

frm1.seg1.setData = data;

here boxRef1, boxRef2, boxRef3 are the segment row templates already defined in the IDE >template >segments sections.