Delete child list data table records

Dear Plumsail Support Team,
I have a specific scenario as following:
I created a form A for a main list A and within the same form A, there is a sub form (list control) for another list B.
The list A is the parent form and the list B is the child list form.

Our concern is to delete all the records in the child list B using a trigger button in the form of the list A instead of deleting each record alone and for sure must be deleted from the list B.

I think that the child list B is a data table type and it should be a solution like a loop!

Would you please guide me to get suitable script for this scenario?
thank you
2019-01-19_16-13-07

Dear Georges,

Seems pretty doable! :grin:

You can delete items from the list B using PnP JS:https://github.com/SharePoint/PnP-JS-Core/wiki/Working-With:-Items (it’s already built in Forms).

After that - refresh data table:

fd.control("SPDataTable0").refresh()

And hide a column with “delete” option:

fd.control("SPDataTable0").widget.hideColumn(0)

Notice that “hideColumn(0)” uses zero-based index of the columns.

Let me know if you have any troubles with code or need any help!

Thank you AlexZver for your generous information i will check and test the script and get back to you in case of any other needs.
cheers

I have a similar situation. I configure a delete button In toolbar that for each selected item, search in another list using pnp and delete it.

I put in the button function fd.control('LIST').refresh() but when I push the button, even though it delete item in list b correctly, I can see the item in list control until I push the standard refresh button.

I also try with

fd.control('ListMoveVenduti').ready().then(function(dt) {
fd.control('ListMoveVenduti').refresh();
});

but the problem remains.

Any Idea?

Hi @Fritz77,

This issue could be caused by the control refreshing before the list is updated. Could you share all of the JavaScript code on the form?

I had to add a 45" delay and then refresh works