Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Add dynamic Row to Table with new access property

Avatar

Level 2

Hello All,

I have a scenario where:

1. I have a Table with Rows with readOnly property.

2. I want to add a new Row to the table dynamically, and that new Row should be writeable.

3.I have added the the following line in the click event of the button which adds a new row.

form1.Table1.Row1.access="";

But in the output the Row gets added which is not writeable.

If we add

form1.Table1.access = "";

then, new Row gets added but it changes the access of the whole table to writeable.

I want to change the access of the newly added row only and not the existing rows.

How can we do it?

Thanks and Regards,

Nikhil

1 Accepted Solution

Avatar

Correct answer by
Level 5

Hi Nikhil,

Please refer below script it would help you...

You need to insert below script on the click event of the button...

form1.Page1.Table1.Row3.instanceManager.addInstance (true);

var countVal = (form1.Page1.Table1.Row3.instanceManager.count - 1);

xfa.resolveNode("form1.Page1.Table1.Row3["+countVal+"].TextField1").access = "open";

xfa.resolveNode("form1.Page1.Table1.Row3["+countVal+"].TextField2").access = "open";

xfa.resolveNode("form1.Page1.Table1.Row3["+countVal+"].TextField3").access = "open";

This is how my table looks.


Script1.png

If it doesnt work please let me know vl share the file.

Thanks

Vijay

    

View solution in original post

6 Replies

Avatar

Level 10

The syntax is access = "open";

Avatar

Level 2

Hi Jono,

Thanks for the reply.

When I use access="open" on a button click, the newly added  row does not change  from readOnly to Open.Capture.PNG

I want to change the access of the row which is getting added dynamically. .

How can we make this happen?

Thanks and Regards

Nikhil

Avatar

Correct answer by
Level 5

Hi Nikhil,

Please refer below script it would help you...

You need to insert below script on the click event of the button...

form1.Page1.Table1.Row3.instanceManager.addInstance (true);

var countVal = (form1.Page1.Table1.Row3.instanceManager.count - 1);

xfa.resolveNode("form1.Page1.Table1.Row3["+countVal+"].TextField1").access = "open";

xfa.resolveNode("form1.Page1.Table1.Row3["+countVal+"].TextField2").access = "open";

xfa.resolveNode("form1.Page1.Table1.Row3["+countVal+"].TextField3").access = "open";

This is how my table looks.


Script1.png

If it doesnt work please let me know vl share the file.

Thanks

Vijay

    

Avatar

Level 2

Hi Vijay,

Thanks for your reply.

I tried the script, but the new row which is added is still readOnly.

Screen11.jpg

I want the new row to be of Open access.

Could we share the file.

Thanks and Regards

Nikhil

Avatar

Level 2

Hi Vijay,

Thanks a lot for the correct answer.

Thanks and Regards,

Nikhil Joshi