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.
subform delete event?
-
- Posts: 75
- Joined: Tue Dec 26, 2017 8:58 pm
subform delete event?
The main record stores a variety of summarised information from the subform records.
i can keep the information updated in all circumstances apart from one: when a subform record is deleted.
There doesn't appear to be an event for this.
The only work around i can think of is to add a nuBeforeSave function and then use the nuSubformObject's deleted array as a reference to reprocess the summary data before saving.
Is this the best solution?
i can keep the information updated in all circumstances apart from one: when a subform record is deleted.
There doesn't appear to be an event for this.
The only work around i can think of is to add a nuBeforeSave function and then use the nuSubformObject's deleted array as a reference to reprocess the summary data before saving.
Is this the best solution?
Re: subform delete event?
alf1976,
You can figure out a lot about what's happened in a Subform using the nuSubformObject() function in Javascript (client side) or PHP (server side).
eg. in PHP Before Save you could do this...
Steven
You can figure out a lot about what's happened in a Subform using the nuSubformObject() function in Javascript (client side) or PHP (server side).
eg. in PHP Before Save you could do this...
Code: Select all
if(array_sum(nuSubformObject('zzzzsys_browse_sf')->deleted) > 1){ //-- a record will be deleted
//-- do something
}
-
- Posts: 75
- Joined: Tue Dec 26, 2017 8:58 pm
Re: subform delete event?
Hi Steven,
Is to safe to add an onchange event to subform delete checkbox?
Andrew
Is to safe to add an onchange event to subform delete checkbox?
Andrew
Re: subform delete event?
alf1976,
You said...
Steven
You said...
Are you updating data in the browser (without saving a record) or are you updating tables on the server?i can keep the information updated in all circumstances apart from one: when a subform record is deleted.
Steven
-
- Posts: 75
- Joined: Tue Dec 26, 2017 8:58 pm
Re: subform delete event?
On the browser. If the user clicks on the delete record checkbox on the sub form I need to update the summary costs on the main record to exclude that record. As this is an estimate the correct costs needs to be displayed at all times. So I need a way to catch this event. I’m guessing I could use jquery to add a .on(“change”, handler) to each click box but I didn’t know if this would affect nuBuilder in an adverse way
Re: subform delete event?
Andrew,
I have added an event called clickdelete to a subform's possible events.
You'll need the latest from Github and you'll need to run Update.
Let me know if it works for you (if you want to try it).
Steven
I have added an event called clickdelete to a subform's possible events.
You'll need the latest from Github and you'll need to run Update.
Let me know if it works for you (if you want to try it).
Steven
-
- Posts: 75
- Joined: Tue Dec 26, 2017 8:58 pm
Re: subform delete event?
Hi Steven,
I will happily give it a try.
i got around the issue originally by adding..
to each active record when the form opens and again in the onAfterInsertRow event to catch new records.
Your new event is a far more preferable solution.
I will happily give it a try.
i got around the issue originally by adding..
Code: Select all
$('#subformobjectName'+nuPad3(index)+'nuDelete').on( "click",
function(event)
{
DeleteSubRecordClick(event);
});
Your new event is a far more preferable solution.
Last edited by alf1976 on Sat Apr 21, 2018 12:11 am, edited 1 time in total.
-
- Posts: 75
- Joined: Tue Dec 26, 2017 8:58 pm