Datatable: How to send to a custom sitepage when editing or adding item

1/ I have to use a mixture of Plumsail Datatable and a custom sitepage made with custom spfx.
I would use a Plumsail Datatable but when clicking in edit of an item, instead of opening the default formulary of the ítem, let's say, "purchases", it must go to a URL of type /SitePages/Purchase.aspx?idItem=20.
2/ The same for New ítem

How can I do that? Thx.

Dear @Miguel,
Are we talking about List or Library control? You should be able to modify Edit and New buttons to open different page in dialogue, however it might break some of the control's functionality, like automatic Parent/Child lookup connection. Here's how to modify New and Edit buttons' functionality - Work with buttons on the toolbar of a List or Library — SharePoint forms

It's for the list grid / datatable. The link you provide is very interesting, but there, they don't explain how to change the behaviour of the edit row, or the new button.
If I edit or press new button, I would like to redirect to a custom sitepage of my own, that does not use Plumsail.

Dear @Miguel,
You say Datatable, but what you describe is more similar to List or Library control.

Which one do you mean?

Sorry, List or Library :frowning: I am new to this.

Dear Miguel,
It would be something like this for what you need:

fd.spRendered(function() {
    fd.control('SPDataTable1').ready(function(dt) {
        //dt parameter is the same as fd.control('SPDataTable1')
        dt.buttons[1].click = function() {
            var item = fd.control('SPDataTable1').selectedItems[0];
            var url = fd.webUrl + '/SitePages/Purchase.aspx?idItem=' + item.ID;

This should work, but might break some of the List or Library control's functionality. More on working with Dialog here - Managing dialog with JS — SharePoint forms

1 Like