API requests per row

API requests per row

asdutoitasdutoit Posts: 5Questions: 2Answers: 0

Hi Guys,

I have a Datatable and some rows.

Each row has a button (linked to form submit) that can make an API POST request.
Although everything works great, when a POST request is made, the type client typically needs to wait 5 seconds or so for the request complete and the page to reload.

Is there a way that Datatables allow a POST request to be made, the page immediately refreshes and then just that particular row can perhaps have a progress indicator?

Oh and yes, I am new

Regards,
Stephan

Answers

  • kthorngrenkthorngren Posts: 20,315Questions: 26Answers: 4,771

    There is nothing built in to do this but it can be done. How specifically you would do this would depend on your particular solution is setup. Generically I would look at using row().data() to update the row with whatever you want to show for progress or something like "Please wait". Then let the ajax request progress normally followed by the reload.

    Kevin

  • asdutoitasdutoit Posts: 5Questions: 2Answers: 0

    Ah ok. You don't by any chance have a sample code for such an operation, do you?
    Not a big deal if you don't I will consult the docs.

  • kthorngrenkthorngren Posts: 20,315Questions: 26Answers: 4,771

    This is what I was thinking:
    http://live.datatables.net/bewifiso/1/edit

    This is not specific to what you have and likely will need changes.

    Kevin

  • asdutoitasdutoit Posts: 5Questions: 2Answers: 0

    That's perfect. Exactly what I need. Ok let me play around with this. I am sure I can make it work. Just need a push in the right direction

This discussion has been closed.