How to create Rows dynamically from Code without binding

Avatar

Avatar
Validate 1
Level 1
dhruvinm
Level 1

Like

1 like

Total Posts

14 posts

Correct reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 1
dhruvinm
Level 1

Like

1 like

Total Posts

14 posts

Correct reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
dhruvinm
Level 1

19-04-2021

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

19-04-2021

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