odennis1
Scholar

How do you select the first or middle row of a repeating section using JavaScript?

I have a repeating section that I am manipulating in various ways.  One of the ways I am doing so is by deleting the last row b using the following Javascript:

 

NWF$('.rsdata .nf-repeater-row:last').find('.nf-repeater-deleterow-image').click();

(The CSS of the repeating section is "rsdata".)

 

I am also trying to delete the first row of the repeating section.  I've tried to change "last" for "first" but that has not worked.  Also, I am trying to delete a row in the middle (not the first or last).  Is there a way to delete it using a sort of "indexing" method?  Any help is appreciated!

 

Thank you,

Owen

0 Kudos
Reply
5 Replies
Tarf
Explorer

Re: How do you select the first or middle row of a repeating section using JavaScript?

Hi @odennis1,

I´d recommend playing in your browsers dev tools on what is returned when you execute

NWF$('.rsdata .nf-repeater-row')

 You should reveice an array of all repeater-rows in the rsData Container (the repeating section). With this, you have all the indexing methods you need.

0 Kudos
Reply
odennis1
Scholar

Re: How do you select the first or middle row of a repeating section using JavaScript?

Thank you for the response @Tarf. Where in the Development tools do I need to go to find that executable? I've used the search tool on almost every script and cannot find it.

0 Kudos
Reply
Tarf
Explorer

Re: How do you select the first or middle row of a repeating section using JavaScript?

Hi @odennis1,

in Chrome you can access the dev tools using F12 -> Console -> start typing.
But that differs from browser to browser

0 Kudos
Reply
alhildreth
Scholar

Re: How do you select the first or middle row of a repeating section using JavaScript?

Thanks for your unintended help.

I needed the code - I had been trying to find how to delete a row. Since Nintex Forms doesn't allow a button for "Delete" to be put onto each row in the repeating section, I give the option to "Delete Last Row" with a button. You gave me the code - I just have to use the correct repeater CSS name.

NWF$('.rsdata .nf-repeater-row:last').find('.nf-repeater-deleterow-image').click();

Thanks again!

0 Kudos
Reply
odennis1
Scholar

Re: How do you select the first or middle row of a repeating section using JavaScript?

Happy to unintentionally help! Good luck with your code!
0 Kudos
Reply