cancel
Showing results for 
Search instead for 
Did you mean: 
Automation Master
Automation Master

Re: Dynamically add a new row to a repeating section

Jump to solution

As you populate test values, you can maybe hide all the controls with the formatting rules.

0 Kudos
Reply
Not applicable

Re: Dynamically add a new row to a repeating section

Jump to solution

Caroline,

I have these text boxes inside of a  repeating section and I'm hiding the first row on form load. If i use the formatting rules to hide these text boxes, then these text boxes will not appear on New added rows .

Thanks,

0 Kudos
Reply
Automation Master
Automation Master

Re: Dynamically add a new row to a repeating section

Jump to solution

If you base the formatting rule on the content that you populate using JavaScript, you will be able to only hide the first row.

In your JavaScript code, after updating the value of a control, add the following lines to force the formatting rule to be executed var yourControl = NWF$("#"+  yourControlId); 

NWF.FormFiller.Functions.ProcessOnChange(yourControl);

Reply
Not applicable

Re: Dynamically add a new row to a repeating section

Jump to solution

Hi Caroline,

As usual thanks for the help and providing the inputs .

Here is what I have done and the issue in detail

1. Below  are the controls in design time. One rep section and 2 text boxes(txtfname, txtlname) within the repeating section. I have other controls below the repeating section as you can see 2 other text boxes.

Image 1.jpg

2. Below are the formatting rules i have set for my 2 textboxes within the rep section

Rule for First TextBox.jpg  Rule for Second TextBox.jpg

3. below is the JS i use to hide the repeating section first row and the controls within the first row

/*Hide the Row*/

NWF$(document).ready(function() {NWF.FormFiller.Events.RegisterAfterReady(function() {     

//nf-repeater-row:first

NWF$(".repclass .nf-repeater-row").hide();

NWF$(".repclass .nf-repeater-row .txtfnamecss").val("work");

NWF$(".repclass .nf-repeater-row .txtlnamecss").val("hello"); 

//var yourControl = NWF$("#"+  yourControlId);

var txtfnameControl = NWF$(".repclass .nf-repeater-row .txtfnamecss");

var txtlnameControl = NWF$(".repclass .nf-repeater-row .txtlnamecss");

//NWF.FormFiller.Functions.ProcessOnChange(yourControl);

NWF.FormFiller.Functions.ProcessOnChange(txtfnameControl);

NWF.FormFiller.Functions.ProcessOnChange(txtlnameControl);

  });});  /*Hide the Row*/

4. On run time, this is the behavior on form load

in runtime.jpg

As you can see the first row and the controls are getting hidden but it leaves the blank space within the repeating section.

(In my business case, this repeating section row has number of such text boxes and it creates large blank space .) . I want to get rid of this blank space, since the row and controls  are hidden,

5. On clicking 'Add new row' . There is a new row added (in white background), but it also creates additional blank space below the newly added row.

I presume that the additional blank space is being created by the blank row in the previous step.

Clickin on AddNewRow in runtime.jpg

Thanks

0 Kudos
Reply
Automation Master
Automation Master

Re: Dynamically add a new row to a repeating section

Jump to solution

Can you try to comment the following line :

NWF$(".repclass .nf-repeater-row").hide();

Do the formatting rules work ?

0 Kudos
Reply
Not applicable

Re: Dynamically add a new row to a repeating section

Jump to solution

YEs the formatting rules do get fired and works . The controls i.e the text boxes Do hide ​but still leave a blank space within the row.

0 Kudos
Reply
Automation Master
Automation Master

Re: Dynamically add a new row to a repeating section

Jump to solution

Is there also a blank space for the others rows ?

In the repeating section, it is known that there are blank spaces when controls are hidden. You can add your vote on this feature request in the user voice site :

Repeating sections should have an auto size option for hidden sections. See attached screenshots, it...

You can try to change the height of the first row using CSS but there could be side effects.

0 Kudos
Reply
Not applicable

Re: Dynamically add a new row to a repeating section

Jump to solution

Hi Caroline,

Thanks for your help. I was aware if this existing issue with  blank space within the repeating section when controls are hidden but was still looking for other workarounds.

I have tried to hide to first row <div>and adjust the height of the first  row using css, but as you mentioned, this is causing other unwanted effects on rows of the repeating section.

For now, we have left the first row as is , with some default text in the required fields and probably will have to train the users accordingly around this .

0 Kudos
Reply
anairat
Nintex Newbie

Re: Dynamically add a new row to a repeating section

Jump to solution

Howq could we populate a repeater with data automatically from list, fo rexample of we have current employee name, and all employees reporting that employee, i need teh repeater to be automatically populated with employee name, position, another column as drop down yes/no

exaple:

employee Z has two employees (x and y) reporting to him, so when Z filled the request, i need teh repeater to contains teh following into the repeater automatically:

X       Senior Developer   yes/no(drop down)

Y        Accountant            Yest/No (Drop Down)

Note that data above is stored in an sql table or shartepoint list that x is reporting to Z, and Y is reporting to Z in addition to their position or job titles

0 Kudos
Reply
Automation Master
Automation Master

Re: Dynamically add a new row to a repeating section

Jump to solution

If you need these data to be displayed when another control is populated, then you can do it using javascript. You maybe need an API to get data from a SQL table in javascript or create an external list in SharePoint connected to this SQL table and then retrieve data from the SharePoint list using SharePoint's API.

You can follow examples in this discussion to populate fields in the repeating section based on CSS class. Then, to add a new row in the repeating section using Javascript, you can use the following code (for this example, you need to add  "myrepclass" CSS Class to your repeating section control):

NWF$(".nf-repeater.myrepclasss a.ms-addnew").click();

Hope this helps

0 Kudos
Reply