Queuing changes in Razor Pages with an API backend

Queuing changes in Razor Pages with an API backend

dwatkinsdwatkins Posts: 1Questions: 1Answers: 0
edited August 2019 in Free community support

I've been working on a proof of concept for my employer using DataTables Editor and I've run into a bit of a roadblock. Following this blog post, https://datatables.net/blog/2017-10-24, I was able to get queued changes mostly working. The only thing I am stuck on is the actual saving of the changes to the database. The issue is that the PUT request doesn't contain any data, only the action.

All of our infrastructure is firewalled, so I can't really post a link to the table for other people's eyes, not without a pretty big amount of work to host it at home or on Azure or something of the sort. Instead, I'll post snippets of code in the Edit pipeline. I also did try to run the Datatables Debugger just in case, but received a 500.

This bit stores the IDs of rows that are changed and enables the Save and Discard buttons. I'm including this, although I barely changed it from the blog post, to denote where my code deviates from the example in the blog post:

This bit is the code for the save button, which uses the edit() api
If there is a problem in any of these, I suspect it would be in this one or the next one:

This bit is the ajax edit definition for the ajaxEditor table referenced above:

This bit is the code-behind for the Razor Page to capture the PUT request and forward it to the API. It's currently stripped down until I am able to get the data into the Request object:

Beyond this, the API will be called to perform the Update when the PUT request is received by the Razor page, but that is immaterial to how the update data gets put into the Request object.

Any tips? I have been able to get standard CRUD operations to work perfectly fine using this model so far, and queuing changes would be an amazing feature to have in my proof of concept.

Answers

  • allanallan Posts: 63,180Questions: 1Answers: 10,411 Site admin

    Could you add:

    ajaxEditor.on('preSubmit', function( e, data, action ) {
      console.log( action, JSON.stringify( data ) );
    } );
    

    And show me what is displayed on the console when you submit the queued changes please?

    Thanks,
    Allan

This discussion has been closed.