Does dataTables support calls to MS SQL Server stored procedures?

Does dataTables support calls to MS SQL Server stored procedures?

IUnknownIUnknown Posts: 3Questions: 1Answers: 0

I've been reading the forums for the last 2 hours, but I couldn't find any support of stored procedure calls.
Without stored procedures as a data source, dataTables looks pretty useless for any serious project. No offenses please: this is just a bit of criticism.

I have a stored procedure with 800+ lines of code. Can you imagine how complex it is? I need to fill the dataTable with this SPs output. These is no way to replace the SP with either multiple joins or views. The logic is in there!

Is there any roadmap for that?
I am particularly interested in calling MS Server Server stored procedures.

btw, the https://datatables.net/development/server-side/ page is down or non-existent.

Replies

  • allanallan Posts: 61,716Questions: 1Answers: 10,108 Site admin

    No offence taken. The server-side data store is irreverent to DataTables itself. You can use stored procedures, static files, grouped elephants, whatever you want. The key is to get the data out of whatever your data store is in JSON. DataTables is a client-side library so it won't help you do that (supported every server-side environment would be simply impossible). But most server-side environments will have an easy way to pull data out of their database and then encode it as JSON.

    See this section of the manual for JSON data loading.

    Allan

  • IUnknownIUnknown Posts: 3Questions: 1Answers: 0

    @allan, you are totally right. In terms of decomposition, a dataTable is just a component which accepts a typed parameter (in this case - a specific JSON string).

    It took me about a day to craft the required functionality. Now I have the following logic implemented:

    1. a dataTable initiates a request, ajaxing the draw, start and length attributes to a PHP-script.
    2. PHP-script calls a stored procedure on the SQL Server 2017 returning draw, recordsTotal and recordsFiltered parameters with the data in a JSON object.
    3. a dataTable renders the data to a nicely styled table ;)

    Thank you for guiding me.
    I could to a tutorial of what I did to publish it on your web-site.

  • allanallan Posts: 61,716Questions: 1Answers: 10,108 Site admin

    I'm sure others would appreciate it! Even if you were just able to publish the code that you've cooked up.

    Allan

This discussion has been closed.