GraphQL integration
GraphQL integration
I searched the forums for GraphQL but was surprised that there were no references to it. I'm just starting out using GraphQL so I was interested to see if I could get DataTables working against an endpoint. It was a learning exercise but I was able to get it working against the test GraphQLZero service and thought that I would share my efforts with the community.
I created a JS Bin that sends a GraphQL query to the test endpoint. It supports DataTables native pagination, sorting and searching. I wonder if an example like this could be added to the Server-side processing examples page as there may be others that need this. The next logical step would be to have Editor interface to GraphQL using mutation to add/edit/delete records.
Replies
Your JS Bin reports numerous errors.
It works fine in JSFiddle I guess JS Bin doesn't like template strings (backtick character). Full code listing below for future reference.
EDIT: If you add
//jshint esnext:true
to the beginning of the code in JS Bin the errors will disappear.Took a crack at using Editor for mutation and the code below is an initial effort just for create. It's worth noting that the returned data is superfluous when using server side processing as DataTables will redraw regardless.