Reputation: 2434
Desipite reading numerous answers related to this issue, I have not been able to understand how to implement Promises in my example. I have a DataTables table defined like this:
$(function () {
var yadcf_data_3;
var oTable = $('#example').DataTable({
"serverSide": true,
"ajax": {"url": "/platform/elements/?format=datatables",
"dataSrc": function(json){
yadcf_data_3 = json.options.yadcf_data_3
//this line returns the appropriate list of values
console.log(yadcf_data_3)
return json.data;
}
}
});
//this line returns undefined
console.log(yadcf_data_3)
//other stuff
yadcf.exRefreshColumnFilterWithDataProp(oTable, 3, yadcf_data_3);
});
How do I use yadcf_data_3 to populate a filter for the table? yadcf_data_3 returns undefined outside of the oTable variable. I know I need to use Promises (instead of callbacks since Promises appear to be the future).
Upvotes: 0
Views: 143