[Data Grid] Data Grid using POST API

Forge Component
(25)
Published on 31 Jul (3 weeks ago) by OutSystems R&D
25 votes
Published on 31 Jul (3 weeks ago) by OutSystems R&D

Can you consume POST APIs using DataGrid? 

I currently have a POST API which takes a SQL query as the body of the API request and returns a json of data as the response, I have previously been passing this response to a pure js table (Handsontable). However i would like to use this functionality within DataGrid to make the most of its built in functions.

Any help on this would be great!

Thanks!



Hi Joseph,


Are you using this method for a purpose of rendering the grid? Just because is a best practice to use a 'GET' method for it, a 'POST' should be only when submitting the data to the server.


I would recommend, if this is the case, that you should change the REST api to a 'GET', this should be the way to go, depending on you're use case of course.


If this is not possible, you can always override the function that fetch's the data for the grid, is the following:

GridOS.DataFeature.getGridData

You can find the function on the GridComponent script, and change the method from 'GET' to 'POST', if you need further help, let me know, I can send you a snippet for that.


Cheers,
David