Hello,
I have a sub-form with 2 objects:
- a lookup
- a display
The lookup table contains only foreign key, the labels are into other tables.
I use a dedicated Browser form to help the user navigate into that table and it relations.
The display objects allow me to retrieve the label for the user to see the information linked to the lookup objects.
But it does not works just after adding a new row into the sub form.
Probably because the database is not yet written.
It updates after a save action.
But in-between the user can't understand what he is doing.
So this probably the wrong way to do that but I do not find how to do it ?
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Display filed into subform does not update after add new row ? Topic is solved
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: Display filed into subform does not update after add new row ?
Hi,
The display objects needs refreshing when a value is picked from the lookup. To do so, I added a new JS function nuSubformRefreshDisplayObject().
But it is not quite finished yet.
The display objects needs refreshing when a value is picked from the lookup. To do so, I added a new JS function nuSubformRefreshDisplayObject().
But it is not quite finished yet.
Re: Display filed into subform does not update after add new row ?
Hello Kevin,
I have found a workaround that works fine.
Onto the "afterinsertrow" of the Subform I put a call to nuRunPHPHidden on a dedicated PHP procedure.
I have created a hidden PHP procedure to select the same values than the one used into the display object and and a call nuJavascriptCallback to update it into the JS space.
It is a bit complexe but it works fine at the end.
But I will be interested to simplify when the nuSubformRefreshDisplayObject will be ready.
Thanks.
I have found a workaround that works fine.
Onto the "afterinsertrow" of the Subform I put a call to nuRunPHPHidden on a dedicated PHP procedure.
I have created a hidden PHP procedure to select the same values than the one used into the display object and and a call nuJavascriptCallback to update it into the JS space.
It is a bit complexe but it works fine at the end.
But I will be interested to simplify when the nuSubformRefreshDisplayObject will be ready.
Thanks.
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: Display filed into subform does not update after add new row ?
This is now how to update a display in a subform after a lookup value has been picked with the new function nuSubformRefreshDisplayObject()
Code in LUJS (lookup JS):
Code in LUJS (lookup JS):
Code: Select all
let subformPk = 'nuaccessforms'; // subform's primary key (15-characters unique id)
let updateObjectId = 'display_obj'; // id of you display object
let prefix = String($('#' + target).attr('data-nu-prefix'));
nuSubformRefreshDisplayObject(prefix, updateObjectId, subformPk);