Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

How to create Rows dynamically from Code without binding

dhruvinm
Level 2
Level 2

Dear All,

I have few fields in my Form which comes as below.

field a = test1|test2|test3

now i have splitted that with " | " but i when i try to add that in table only first line shows up.

 

 

Code :

var prBatchTable = prBatch.formattedValue.split("|");

if (prBatchTable[0] != "") {
for (i = 0; i < prBatchTable.length; i++) {
curRow = this.resolveNode("Row1[" + i + "]");
curRow.Cell3.rawValue = parsednew;
}
}

 

/// Also tried manully doing the loop

curRow = this.resolveNode("Row1[" + 0 + "]");
curRow.Cell3.rawValue = "11";

 

curRow1 = this.resolveNode("Row1[" + 1 + "]");

curRow1.Cell3.rawValue = "22";

 

How can i create multiple instance of Row1?

 

Dynamic table.PNG

1 Reply
radzmar
Level 10
Level 10

Hi,

 

you need to set the number of instances of the row depending on your input.

 

var aBatchTable = prBatch.formattedValue.split("|"),
    oRows;
// Set instances of rows
Table1._Row1.setInstances(aBatchTable.length);
// Resolve all rows into a node list
oRows = Table1.resolveNodes('Row1[*]');
// update value in every row
aBatchTable.forEach(function (element, index) {
    oRows.item(index).Cell3.rawValue = element;
});