DataTables and Promises
DataTables and Promises
totumfacky
Posts: 4Questions: 2Answers: 0
Hi!
I am developing SPA based on EmberJS and Metronic HTML template which uses DataTables plugin as a base of its grids.
The thing is I have to build complex Grid component, where I can use promises returned by
EmberJS Rest api which uses jQuery Promises.
DataTables is jQuery plugin, and jQuery supports Promises. How can I pass a promise to DataTables so it could initialize with data it will get from Promise?
Best regards
This discussion has been closed.
Answers
DataTables itself does not current implement any, or look for any promises. This is something that I will be looking at in a future release.
At the moment you would need to use some external code that would wait until your promise is completed and then use the DataTables API to add the data to the table.
Allan
Could you be more specific when it will be, the future release, please? Few weeks, a month?
If it is soon, I could write some ugly code and wait for new version... I really am looking
forward to it, because it is a standard now! And helps keep code clean.
Not really as it isn't something that I've planned out yet. All I can say is that it on my ever growing list of things to do and I hope to get to it soon.
I would be interested to see how you would like to use it. Presumably you want to pass a promise to
rows.add()
ordata
?Allan
I would like to use
data
, so I could just setup DT with data loaded via ajax call but made "outside" of DT (by Ember JS)Now I'm digging into this example https://datatables.net/examples/server_side/pipeline.html. Maybe I could adjust it for my needs?
Yes, I'm certain you could if you are using server-side processing.
Allan