Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Add rows to subform

Questions related to using nuBuilder Forte.
marc
Posts: 92
Joined: Mon May 14, 2018 3:26 pm

Add rows to subform

Unread post by marc »

Hey,

I created a form that contains a subform grid. Upon loading the edit screen, I run a script to add some additional rows to the subform.

Like this:

Code: Select all

nuAddRow('sub_grid' );
nuAddRow('sub_grid' );
nuAddRow('sub_grid' );
nuAddRow('sub_grid' );
nuAddRow('sub_grid' );
But just one row is added, not 5!

Test done with a nuBuilder Form: Same result!
addrow.JPG

Code: Select all

nuAddRow('accform' );
nuAddRow('accform' );
nuAddRow('accform' );
nuAddRow('accform' );
How do I prepopulate more than one row?
You do not have the required permissions to view the files attached to this post.
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: Add rows to subform

Unread post by toms »

marc,

It works for me - but only if the first control is a not a lookup object. It seems to be a glitch.

Workaround: add a dummy input field as first element in the grid with width = 0 and disabled = false.
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Add rows to subform

Unread post by admin »

marc,

It works for me as well.

Steven
marc
Posts: 92
Joined: Mon May 14, 2018 3:26 pm

Re: Add rows to subform

Unread post by marc »

admin wrote:marc,

It works for me as well.

Steven
@Steven:
and you tried it on a subform where the first element is a lookup object?
(see my example above, access level screen, forms grid)

@toms: WIll give it a go unless there's a patch.
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: Add rows to subform

Unread post by toms »

Timo, yes the issue only occurs when the the first object in a grid row is a lookup object.
2018-07-11_073153.png
If you add several rows in one go, only 1 row will be added:

Code: Select all

nuAddRow('accform' );
nuAddRow('accform' );
nuAddRow('accform' );
nuAddRow('accform' );
nuAddRow('accform' );
Eg. if you add a timeout before adding a new row, all rows will be added.

Code: Select all

var d  = 50;
for (i = 0; i < 20; i++) { 
  setTimeout(function() {
  nuAddRow('accform' );
}, d);
d += 50;
}
You do not have the required permissions to view the files attached to this post.
marc
Posts: 92
Joined: Mon May 14, 2018 3:26 pm

Re: Add rows to subform

Unread post by marc »

@Steven Have you been able to reproduce this bug?
the issue only occurs when the the first object in a grid row is a lookup object.
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Add rows to subform

Unread post by admin »

marc,

No, I can't.

It works for me on Access Levels > Form Tab (which starts with a Lookup).

Steven
marc
Posts: 92
Joined: Mon May 14, 2018 3:26 pm

Re: Add rows to subform

Unread post by marc »

Hi,

I got the latest from Gihub. Still one row is added, although I add several. I also recorded a Video so you could see it visually.

https://streamable.com/jdoph

I also tried it on your demo site https://demo.nubuilder.net/ with the same result.
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Add rows to subform

Unread post by admin »

marc,

It seems the process of loading a lookup in a new row (which may need data from the server) means you may need to pause between running nuAddRow().

I would just use toms workaround.

Steven
marc
Posts: 92
Joined: Mon May 14, 2018 3:26 pm

Re: Add rows to subform

Unread post by marc »

admin wrote: It seems the process of loading a lookup in a new row (which may need data from the server) means you may need to pause between running nuAddRow().
Well, the adding works well if the lookup is not the first element in the row. That's why I think there's another reason.
Post Reply